pipekit-evaluate¶
Multidimensional evaluation framework. The benchmark subpackage ships
the orchestration layer of the benchmark ladder — the
level x rung x complexity cube, the carrier-agnostic protocols, and
the "simpler thing is ground truth" reference rule. The taxonomy
module carries the Unit x Lens x Stage tags, MetricScorer turns
any metric operator into a tagged scorer, and evaluate collects a run's
tagged scores into a content-hashed EvaluationReport. Design doc:
packages/pipekit-evaluate/docs/design/benchmark_ladder.md.
Taxonomy¶
pipekit_evaluate.taxonomy
¶
The Unit x Lens x Stage taxonomy, carried by scorers as data.
An evaluation picks one value on each of three axes:
- Unit — what is scored: a field, a statistic, a trajectory, an event or a budget.
- Lens — what kind of failure the score can see: point-wise, probabilistic, spectral, structural, detection or physical-constraint.
- Stage — where in a model's life the score may run (training, validation, final evaluation, monitoring), which bounds how cheap and differentiable it must be.
The tags live on the scorer, not on the metric. The metrics stay in the
carrier libraries (xrtoolz.metrics), which never import
pipekit-evaluate; a scorer declares its tags as optional attributes
(unit, lens, stages, differentiable) and :func:tags_of
reads them, filling in the defaults. A scorer with only a name is
therefore a point-wise field score for validation and final evaluation.
Lens
¶
Bases: StrEnum
What kind of failure a score can see.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/taxonomy.py
ScorerTags
dataclass
¶
A scorer's position in the taxonomy.
Strings are accepted wherever an enum member is, and one stage may be
given on its own, so ScorerTags(lens="structural", stages="final")
is valid; the fields always hold enum members after construction.
Attributes:
| Name | Type | Description |
|---|---|---|
unit |
Unit
|
What the scorer scores. |
lens |
Lens
|
What kind of failure it can see. |
stages |
frozenset[Stage]
|
The stages it may run at; never empty. |
differentiable |
bool
|
Whether its value can be differentiated with respect to the prediction (a requirement for use as a loss). |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/taxonomy.py
Stage
¶
Bases: StrEnum
Where in a model's life a score may run.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/taxonomy.py
Unit
¶
tags_of(scorer)
¶
Read a scorer's taxonomy tags, defaulting the ones it does not set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scorer
|
Any
|
Any object; the optional attributes |
required |
Returns:
| Type | Description |
|---|---|
ScorerTags
|
The scorer's :class: |
ScorerTags
|
attributes is a point-wise field score for validation and final |
ScorerTags
|
evaluation, and not differentiable. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an attribute holds a value outside its axis. |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/taxonomy.py
Scorers¶
pipekit_evaluate.scorers
¶
Turn any metric operator into a tagged :class:Scorer.
The metrics live with their carriers (xrtoolz.metrics for xarray,
geotoolz for GeoTensors); :class:MetricScorer wraps one, records its
place in the Unit x Lens x Stage taxonomy, and returns the named scalar
values every scorer returns. Nothing here imports a carrier library: the
metric's output is read structurally.
MetricScorer
dataclass
¶
A metric operator as a tagged :class:Scorer.
The metric is any callable (prediction, reference) -> result, such
as an xrtoolz.metrics operator. An :class:Estimate passed as the
prediction or the reference is handed to the metric as
from_estimate(estimate), by default its point estimate, so the same
scorer serves :func:evaluate-style calls on raw carriers and the
benchmark ladder's estimates. A probabilistic scorer has no default: a
point would silently drop the uncertainty it is meant to score, so it
must say what to take from an estimate (lambda e: e.sample(100)).
The result becomes {name: float}:
- a Dataset-like result (one with
data_vars) gives one entry per data variable; - a mapping gives one entry per key;
- anything else is one value, keyed by its
namewhen it has a string one (a namedDataArray) and by"value"otherwise.
Every value must be a scalar with no dimensions, even singleton ones; a
metric that keeps a dimension (a score per lead time or per region)
must be reduced first. Because the values become Python floats, a
:class:MetricScorer is never differentiable; a scorer meant for use
as a loss implements :class:Scorer itself.
Attributes:
| Name | Type | Description |
|---|---|---|
metric |
Callable[[Any, Any], Any]
|
The metric operator. |
name |
str
|
The scorer's name; defaults to the metric's |
unit |
Unit | str
|
What the metric scores. |
lens |
Lens | str
|
What kind of failure it can see. |
stages |
Stage | str | Iterable[Stage | str]
|
The stages it may run at. |
from_estimate |
Callable[[Any], Any] | None
|
What to hand the metric for an :class: |
references |
ReferenceSource | str | Iterable[ReferenceSource | str] | None
|
The benchmark reference sources the scorer is run
against, as members or their string values; |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/scorers.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
__call__(prediction, reference)
¶
Score prediction against reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prediction
|
Any
|
A carrier, or an :class: |
required |
reference
|
Any
|
A carrier, or an :class: |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
The metric's values by name. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an estimate cannot be handed to the metric (a
probabilistic scorer without |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/scorers.py
Evaluation report¶
pipekit_evaluate.report
¶
The evaluation report: every score of a run, tagged and content-hashed.
:func:evaluate runs a list of scorers on one prediction and one
reference and collects their values into an :class:EvaluationReport.
Each :class:ReportEntry carries its scorer's place in the
Unit x Lens x Stage taxonomy, so a report can be filtered by axis
(report.filter(lens="structural")), compared with an earlier one
(report.diff(baseline)) and identified by a content hash that ignores
when it was made. A benchmark-ladder run becomes the same report through
:meth:~pipekit_evaluate.benchmark.BenchmarkReport.to_report, with each
entry naming its cell and reference.
EvaluationReport
dataclass
¶
The tagged scores of one evaluation run.
Attributes:
| Name | Type | Description |
|---|---|---|
entries |
tuple[ReportEntry, ...]
|
One entry per scorer value; keys are unique. |
model_ref |
str | None
|
What was evaluated (a registry hash, a URI), if known. |
dataset_ref |
str | None
|
What it was evaluated on, if known. |
config |
Mapping[str, Any]
|
Free-form settings of the run, kept as a read-only JSON
snapshot taken at construction: mappings at every depth are
read-only, lists become tuples, and a value that is not JSON (a
|
timestamp |
datetime
|
When the report was made (UTC). Not part of
:attr: |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/report.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
content_hash
property
¶
A sha256 over the entries, the references and the config.
Entry order and the timestamp do not change it, so two runs that
score the same values on the same references hash equal. An entry
without a cell or reference hashes as it did before those fields
existed, so an :func:evaluate report keeps its hash.
values
property
¶
Every value by entry key.
diff(baseline)
¶
The entries whose value differs from baseline's.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
baseline
|
EvaluationReport
|
The report to compare against, such as last week's. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, tuple[float | None, float | None]]
|
|
dict[str, tuple[float | None, float | None]]
|
value changed, with |
dict[str, tuple[float | None, float | None]]
|
Two NaNs count as equal, so a report's diff against itself is |
dict[str, tuple[float | None, float | None]]
|
empty. |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/report.py
filter(*, unit=None, lens=None, stage=None, scorer=None, cell=None, reference=None)
¶
The entries that match every given axis value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit
|
Unit | str | None
|
Keep entries of this unit. |
None
|
lens
|
Lens | str | None
|
Keep entries of this lens. |
None
|
stage
|
Stage | str | None
|
Keep entries whose scorer runs at this stage. |
None
|
scorer
|
str | None
|
Keep entries of the scorer with this name. |
None
|
cell
|
str | None
|
Keep entries of this benchmark cell label. |
None
|
reference
|
ReferenceSource | str | None
|
Keep entries scored against this reference source. |
None
|
Returns:
| Type | Description |
|---|---|
EvaluationReport
|
A report with the matching entries and this report's |
EvaluationReport
|
references, config and timestamp. |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/report.py
to_dict()
¶
A strict-JSON form, with the content hash.
A non-finite float (in a value or in the config) is written as the
string "NaN", "Infinity" or "-Infinity", so the result
passes json.dumps(..., allow_nan=False); :meth:to_records and
:meth:to_pandas keep the floats.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/report.py
to_pandas()
¶
One row per entry, as a pandas.DataFrame.
Raises:
| Type | Description |
|---|---|
ImportError
|
If pandas is not installed. |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/report.py
ReportEntry
dataclass
¶
One named value from one scorer.
Attributes:
| Name | Type | Description |
|---|---|---|
scorer |
str
|
The scorer's name; it may not contain |
metric |
str
|
The value's name within the scorer's output. |
value |
float
|
The value. |
tags |
ScorerTags
|
The scorer's taxonomy tags. |
cell |
str | None
|
The benchmark cell label ( |
reference |
str | None
|
The reference source ( |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/report.py
key
property
¶
The entry's identifier in its report.
"<scorer>.<metric>", prefixed by "<cell>:<reference>:" for a
ladder run, as in "L4/r5/c0:known_theta:rmse.value". Unambiguous
because neither a cell label, a reference source nor a scorer name
has a :, and a scorer name has no .: the scorer ends at the
first dot after the prefix, and the metric name may contain more.
to_record()
¶
A flat, JSON-serialisable record of the entry.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/report.py
evaluate(prediction, reference, scorers, *, stage=None, model_ref=None, dataset_ref=None, config=None)
¶
Score one prediction against one reference with every scorer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prediction
|
Any
|
What is evaluated, in whatever carrier the scorers take. |
required |
reference
|
Any
|
What it is compared with. |
required |
scorers
|
Iterable[Scorer]
|
The scorers; their names must be unique. |
required |
stage
|
Stage | str | None
|
Run only the scorers tagged for this stage; all of them
when |
None
|
model_ref
|
str | None
|
What was evaluated, recorded on the report. |
None
|
dataset_ref
|
str | None
|
What it was evaluated on, recorded on the report. |
None
|
config
|
Mapping[str, Any] | None
|
Settings recorded on the report and in its hash. |
None
|
Returns:
| Type | Description |
|---|---|
EvaluationReport
|
The report, one entry per value each scorer returned. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If two scorers share a name, or a name contains |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/report.py
Protocols¶
pipekit_evaluate.benchmark.protocols
¶
Carrier-agnostic protocols for the benchmark ladder.
These mirror the style of :mod:pipekit_cycle.protocols: small,
runtime-checkable structural interfaces that domain packages
(plumax, somax, xtremax, …) satisfy without importing
pipekit-evaluate. They are the orchestration layer described in
packages/pipekit-evaluate/docs/design/benchmark_ladder.md §4 — the
"who plays which rung" contracts — and sit on top of (not inside) the
Unit x Lens x Stage scorer taxonomy (:mod:pipekit_evaluate.taxonomy).
A benchmark Task reuses pipekit_cycle's ForwardModel /
ObservationOperator as its simulator and observation operator, so a
benchmark is assembled from the same parts a DACycle is. Those types
are referenced under :data:typing.TYPE_CHECKING only, so importing this
module never pulls in pipekit-cycle.
CovarianceEstimate
¶
Bases: Estimate, Protocol
An :class:Estimate that also reports its posterior covariance.
A separate protocol rather than a member of :class:Estimate, so every
existing estimate keeps satisfying :class:Estimate. A scorer that needs
second moments (Gaussian coverage, a Mahalanobis distance, a spread-skill
ratio) checks isinstance(estimate, CovarianceEstimate) instead of
probing attributes or drawing samples.
Members
covariance(): The posterior covariance of :meth:point's quantity,
as a (d, d) matrix for a (d,) point.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/protocols.py
Estimate
¶
Bases: Protocol
A point and/or a posterior produced by an estimator.
Scorers branch on what is present: a point-only estimate returns
None from :meth:sample. Per benchmark_ladder.md §8 decision
1, :meth:sample is the required posterior surface and
:meth:log_prob is optional.
Members
point(): Best point estimate (mean / MAP / MLE), or None.
sample(n, key): n posterior draws, or None if point-only.
log_prob(theta): Optional posterior log-density at theta.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/protocols.py
Estimator
¶
Bases: Protocol
Any rung that maps observations → an :class:Estimate.
The same protocol covers the model-based oracle (rung 2), emulator-based
inference (rung 4) and the amortized predictor (rung 5). rung
locates the estimator on the staged axis (§2.2) and complexity
locates it on the per-rung complexity axis (§2.3).
Members
rung: Position on the staged ladder (1-6).
complexity: Position on the per-rung complexity axis (0 =
simplest). Two estimators sharing a rung but differing in
complexity are the cheap/rich pair scored against each other.
fit(task): Return a fitted estimator (a no-op return self for an
already-trained or closed-form rung-2 oracle).
call(obs): Produce an :class:Estimate from observations.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/protocols.py
Oracle
¶
Bases: Protocol
The designated reference :class:Estimator for a task (usually rung 2).
Not yet consumed by Benchmark — reference selection currently
lives inline in Benchmark._oracle_prediction; this seam exists
for the planned scorer taxonomy, where reference policy becomes
pluggable.
Members
reference_for(task): Return the estimator whose output is the
reference posterior for the fast rungs of task.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/protocols.py
Prior
¶
Bases: Protocol
A minimal prior over task parameters θ.
Deliberately thin (see benchmark_ladder.md §8, decision 2): a
sample surface with an optional log_prob, so neither NumPyro
nor distrax is a hard dependency of the framework core.
Members
sample(n, key): Draw n samples of θ.
log_prob(theta): Optional log-density at theta; implementations
without a tractable density may raise NotImplementedError.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/protocols.py
Scorer
¶
Bases: Protocol
Score one prediction against one reference.
This is the seam onto the Unit x Lens x Stage taxonomy: a concrete
scorer is a (Unit, Lens) pair. The benchmark layer only requires
a name and a callable that returns a mapping of named metric values.
A scorer places itself in the taxonomy through the optional attributes
unit, lens, stages and differentiable, which are not
protocol members; :func:pipekit_evaluate.taxonomy.tags_of reads them
with their defaults, and :class:pipekit_evaluate.scorers.MetricScorer
sets them on any metric operator. A further optional attribute,
references, names the reference sources a scorer can be run
against in the benchmark ladder; without it a scorer is run against
each cell's primary reference only
(:func:pipekit_evaluate.benchmark.run.scores_against).
Members
name: Short scorer identifier, used to namespace its metrics. call(prediction, reference): Named metric values.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/protocols.py
Task
¶
Bases: Protocol
One benchmark scenario: prior + simulator + obs operator + data.
The simulator and observation operator are exactly the
pipekit_cycle protocols, so no parallel hierarchy is introduced.
Members
name: Human-readable task identifier.
domain: Domain tag ("plume" | "ocean" | "land" | …).
prior(): The prior over task parameters θ (rung 1 input).
simulator(): The rung-1 generative ForwardModel (θ → state).
observation_operator(): The state → observations map.
datasets(): The L0..L4 products by key, plus any known truth
(e.g. "theta", "state", "obs") used as references.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/protocols.py
The cube¶
pipekit_evaluate.benchmark.cube
¶
The level x rung x complexity cube.
A benchmark cell is a (data level, inference rung, complexity step)
triple — the single mental model of benchmark_ladder.md §2.4. The
earlier level x rung matrix is one face of the cube, read at a fixed
complexity step.
Cell
dataclass
¶
One cell of the benchmark cube.
Attributes:
| Name | Type | Description |
|---|---|---|
level |
str
|
The data-hierarchy level ( |
rung |
int
|
The staged-ladder rung (1-6). |
complexity |
int
|
The per-rung complexity step ( |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/cube.py
Reference rule¶
pipekit_evaluate.benchmark.reference
¶
The "simpler thing is ground truth" rule, encoded as data.
The single invariant that makes the ladder a benchmark and not five
scripts (benchmark_ladder.md §4.3) runs along both axes of §2:
- the staged axis — the previous rung is the reference;
- the complexity axis — the adjacent (simpler) step is the reference.
Both are data, not code branches: the default tables below live on the
:class:ReferenceRule, which a domain may override (e.g. an oracle-less
domain falls back to known-θ coverage only). Beside each rung's primary
reference, a rung may name further references it is also scored against
(:data:DEFAULT_ALSO): the amortized rung is judged against the oracle's
posterior and, in the same run, against the known truth.
Axis
¶
Bases: Enum
Which benchmark axis a reference is resolved along.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/reference.py
ReferenceRule
dataclass
¶
Resolve the reference source for a rung along a given axis.
Attributes:
| Name | Type | Description |
|---|---|---|
staged |
Mapping[int, ReferenceSource]
|
Per-rung primary reference sources on the staged axis. |
complexity |
Mapping[int, ReferenceSource]
|
Per-rung primary reference sources on the complexity axis. |
also |
Mapping[int, tuple[ReferenceSource, ...]]
|
Per-rung further reference sources, scored beside the
primary one on either axis whenever the primary is not
:attr: |
A complexity step of 0 is the simplest step on its rung and has no
simpler neighbour, so it is resolved as :attr:ReferenceSource.NONE
on the complexity axis regardless of the table.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/reference.py
source(rung, *, axis=Axis.STAGED, complexity=0)
¶
Return the reference source for rung along axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rung
|
int
|
The staged-ladder rung (1-6). |
required |
axis
|
Axis
|
Which axis to resolve the reference along. |
STAGED
|
complexity
|
int
|
The complexity step; only consulted for
:attr: |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
The |
ReferenceSource
|
class: |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/reference.py
sources(rung, *, axis=Axis.STAGED, complexity=0)
¶
Every reference source for rung along axis, primary first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rung
|
int
|
The staged-ladder rung (1-6). |
required |
axis
|
Axis
|
Which axis to resolve the primary reference along. |
STAGED
|
complexity
|
int
|
The complexity step, as for :meth: |
0
|
Returns:
| Type | Description |
|---|---|
ReferenceSource
|
The primary source followed by the rung's :attr: |
...
|
without repeats; empty when the primary source is |
tuple[ReferenceSource, ...]
|
attr: |
tuple[ReferenceSource, ...]
|
further references either. |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/reference.py
ReferenceSource
¶
Bases: Enum
Where a rung/step's ground truth comes from.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/reference.py
as_sources(sources)
¶
Normalise one reference source or several to a set of members.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sources
|
ReferenceSource | str | Iterable[ReferenceSource | str]
|
A :class: |
required |
Returns:
| Type | Description |
|---|---|
frozenset[ReferenceSource]
|
The sources as a frozenset of members. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a string is not a :class: |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/reference.py
Benchmark runner¶
pipekit_evaluate.benchmark.run
¶
The benchmark runner: fill cube cells, resolve references, score.
:class:Benchmark realises benchmark_ladder.md §4.2 (the Benchmark
dataclass) and §4.3 (the reference rule). It is deliberately carrier- and
scorer-agnostic: it fits each estimator, resolves the reference for that
cell via :class:~pipekit_evaluate.benchmark.reference.ReferenceRule, and
delegates the actual critique to the supplied :class:Scorers. Its
:class:BenchmarkReport converts into the tagged, content-hashed
:class:~pipekit_evaluate.report.EvaluationReport that a plain
:func:~pipekit_evaluate.report.evaluate call returns. Writing a
pipekit_experiment.Run per cell is left to a later slice.
Benchmark
dataclass
¶
Run the level x rung x complexity cube and score each cell.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
Task
|
The scenario under test. |
estimators |
Sequence[Estimator]
|
The rungs/steps to fill in (each carries |
scorers |
Sequence[Scorer]
|
The |
level |
str
|
The data-hierarchy level the run sits at (default |
axis |
Axis
|
Which axis to resolve references along (default staged). |
reference_rule |
ReferenceRule
|
The "simpler thing is ground truth" tables. |
reference |
Estimator | None
|
An explicit oracle estimator; when |
obs_key, |
(truth_key, state_key)
|
Keys into |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/run.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | |
run()
¶
Fit every estimator, resolve each cell's reference, and score it.
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/run.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
BenchmarkReport
dataclass
¶
The collected results of a benchmark run.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
str
|
The task name. |
domain |
str
|
The task domain. |
axis |
Axis
|
The axis the references were resolved along. |
results |
Sequence[CellResult]
|
One :class: |
entries |
tuple[ReportEntry, ...]
|
Every scored value as a tagged :class: |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/run.py
to_dict()
¶
A JSON-serialisable form that keeps every reference and note.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
|
dict[str, Any]
|
each cell label to its |
dict[str, Any]
|
|
dict[str, Any]
|
and |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/run.py
to_report(*, model_ref=None, dataset_ref=None, config=None)
¶
The run as an :class:EvaluationReport, one entry per scored value.
Each entry carries its cell label and reference source, so
report.filter(reference="known_theta") or
report.filter(lens="structural") cuts across the cube.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_ref
|
str | None
|
What was evaluated, recorded on the report. |
None
|
dataset_ref
|
str | None
|
What it was evaluated on, recorded on the report. |
None
|
config
|
Mapping[str, Any] | None
|
Settings recorded on the report and in its hash, beside
the run's |
None
|
Returns:
| Type | Description |
|---|---|
EvaluationReport
|
The report; its config holds |
EvaluationReport
|
unless |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/run.py
CellResult
dataclass
¶
The scored outcome for one cube cell.
Attributes:
| Name | Type | Description |
|---|---|---|
cell |
Cell
|
The |
reference |
ReferenceSource
|
The cell's primary reference source. |
scores |
Mapping[str, float]
|
Named metric values (namespaced by scorer) against the primary reference, empty when the cell is not scored or its primary reference was unavailable. |
note |
str
|
Human-readable explanation of every reference that could not be resolved; empty when all of them were. |
by_reference |
Mapping[ReferenceSource, Mapping[str, float]]
|
The scores against every reference that resolved,
primary included, keyed by source. When only |
Source code in packages/pipekit-evaluate/src/pipekit_evaluate/benchmark/run.py
scores_against(scorer, source, *, primary)
¶
Whether scorer is run against the reference source.
A scorer names the reference kinds it can score against in an optional
references attribute (one source or several, as members or their
string values). Without one it is scored against the cell's primary
reference only, so a scorer written for one kind of reference (an
oracle's posterior Estimate) is never handed another (the raw
known truth) because a rung gained a further reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scorer
|
Scorer
|
Any scorer. |
required |
source
|
ReferenceSource
|
The reference source about to be scored against. |
required |
primary
|
ReferenceSource
|
The cell's primary reference source. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|