Skip to content

Unified score() dispatcher #6

Description

@jc-macdonald

Summary

Provide a single-entry-point dispatcher matching the Python scoring.py pattern, so users can call score(:crps, obs, fct) without importing individual functions.

Proposed API

"""
    score(metric::Symbol, obs, fct; kwargs...) -> Float64

Compute the scoring rule specified by `metric`.

Supported metrics: :crps, :energy, :wis, :brier, :log, :rmse, :mae, :coverage.
"""
function score(metric::Symbol, obs, fct; kwargs...)
    # dispatch to specialized implementations
end

Alternatively, use a type-dispatch approach:

abstract type AbstractScoringRule end
struct CRPS <: AbstractScoringRule end
score(::CRPS, obs, fct) = crps_ensemble(obs, fct)

Design Notes

  • Type dispatch is more Julian and extensible.
  • Symbol dispatch is simpler for interactive use.
  • Consider supporting both: score(:crps, ...) as sugar for score(CRPS(), ...).

Depends On

Acceptance Criteria

  • All implemented metrics accessible via score()
  • Informative error for unknown metric symbol
  • Docstring lists all supported metrics

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions