Reference checks¶
check
¶
Checking an experiment's results against stored reference results.
An experiment may name a reference file (reference "PATH" @blake3:...)
and pin the tolerances of the comparison (tolerance mean = 0.05, sd =
0.1), as posteriordb stores reference posteriors to test inference
against. check_experiment compares every point's run with the reference's
point of the same swept values:
- for a fit, every site's posterior mean and standard deviation, elementwise:
the fitted mean must lie within
meanreference standard deviations of the reference mean, and the fitted standard deviation withinsdtimes the reference standard deviation of it; - for a run, the value, elementwise, within the absolute tolerance
value; a value that is not a number must be equal.
Every statistic compared needs a pinned tolerance, so a comparison never
falls back to a default. write_reference stores the current results as a
reference file and returns the pin to write.
REFERENCE_FORMAT
module-attribute
¶
The format of a reference file.
Comparison
didactic-model
¶
Comparison(*, site: str, statistic: Statistic, position: tuple[int, ...], fitted: float | str, reference: float | str, bound: float, passed: bool)
Bases: Model
One compared number.
| PARAMETER | DESCRIPTION |
|---|---|
site
|
The site compared, or empty for a run's value.
TYPE:
|
statistic
|
What is compared.
TYPE:
|
position
|
The element's position in the statistic's tensor.
TYPE:
|
fitted
|
The experiment's number (or a non-numeric value, as JSON).
TYPE:
|
reference
|
The reference's.
TYPE:
|
bound
|
The largest difference accepted.
TYPE:
|
passed
|
Whether the difference is within the bound.
TYPE:
|
PointCheck
didactic-model
¶
PointCheck(*, label: str, comparisons: tuple[Comparison, ...])
Bases: Model
The comparison of one point with the reference.
| PARAMETER | DESCRIPTION |
|---|---|
label
|
The point's swept values.
TYPE:
|
comparisons
|
Every compared number.
TYPE:
|
passed
property
¶
Whether every comparison passed.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True when none failed. |
CheckReport
didactic-model
¶
CheckReport(*, experiment: str, reference: str, points: tuple[PointCheck, ...])
Bases: Model
The comparison of an experiment with its reference.
| PARAMETER | DESCRIPTION |
|---|---|
experiment
|
The experiment.
TYPE:
|
reference
|
The reference file.
TYPE:
|
points
|
One check per point.
TYPE:
|
passed
property
¶
Whether every point passed.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True when every comparison of every point passed. |
reference_data
¶
reference_data(plan: ExperimentPlan, runs: Sequence[PointRun]) -> JsonValue
The reference file content of an experiment's current results.
| PARAMETER | DESCRIPTION |
|---|---|
plan
|
The experiment.
TYPE:
|
runs
|
Its runs.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
JsonValue
|
The reference: one entry per point with its swept values and its posterior means and standard deviations (a fit) or value (a run). |
Source code in src/quivers/experiments/check.py
write_reference
¶
write_reference(plan: ExperimentPlan, runs: Sequence[PointRun], path: str | Path) -> str
Store an experiment's current results as its reference file.
| PARAMETER | DESCRIPTION |
|---|---|
plan
|
The experiment.
TYPE:
|
runs
|
Its runs.
TYPE:
|
path
|
The reference file to write.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The pin to write after the reference's path, |
Source code in src/quivers/experiments/check.py
check_experiment
¶
check_experiment(plan: ExperimentPlan, runs: Sequence[PointRun]) -> CheckReport
Compare an experiment's runs with its pinned reference.
| PARAMETER | DESCRIPTION |
|---|---|
plan
|
The experiment.
TYPE:
|
runs
|
Its runs, one per point.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CheckReport
|
Every comparison, with whether it passed. |
| RAISES | DESCRIPTION |
|---|---|
ExperimentError
|
With code |
Source code in src/quivers/experiments/check.py
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 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | |