factrix.MetricOutput
dataclass
¶
MetricOutput(name: str, value: float, n_obs: int | None = None, stat: float | None = None, significance: str | None = None, metadata: dict[str, object] = dict())
Return type for factrix.metrics.* primitives.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Metric identifier (e.g. "ic_ir", "oos_decay"). |
required |
value
|
float
|
Raw metric value. |
required |
n_obs
|
int | None
|
Sample size the metric primitive's estimator actually
saw. Same family name as |
None
|
stat
|
float | None
|
Test statistic (t, z, W, chi2, ...), when applicable. |
None
|
significance
|
str | None
|
|
None
|
metadata
|
dict[str, object]
|
Tool-specific context ( |
dict()
|
The unified return type produced by every metric in
factrix.metrics. A single dataclass carrying
the canonical scalar (value), the sample size the estimator saw
(n_obs), the test statistic (stat), the significance marker, and
a metadata dict for everything else (p-value, method label,
short-circuit reason, secondary diagnostics). All metrics — primary
or auxiliary — return this shape so downstream code can treat every
metric uniformly. n_obs shares its name with FactorProfile.n_obs
but a different scope: per-metric single-stage count vs. the
final-stage test denominator at the dispatched-cell level.
Resolving MetricOutput.name to a docs page¶
Downstream consumers holding a MetricOutput can map output.name
back to the metric's API page two ways:
- Programmatic —
list_metrics(..., format="json")rows carry anemitted_namefield (the literalMetricOutput.namevalue) and adocs_anchorfield following theDOCS_ANCHOR_FMTconvention defined infactrix._metric_index(docs-root-relative path + mkdocstrings symbol fragment), resolvable without scraping. - Static — the auto-generated table below maps every emitted
MetricOutput.namevalue to the function that produced it and the API page anchor. Regenerated from the sameMatrix-row:SSOT on every docs build.
For most metrics MetricOutput.name equals the function name; a
small set of historical exceptions (e.g. fama_macbeth emits
fm_beta, corrado_rank_test emits corrado_rank) emit a
different label. The first column is what you receive at runtime;
the second column is the import-path callable.