Reports API¶
Plain-dictionary reports, each a method of the object whose data it describes. Guide: Reports.
applied_parameters ¶
applied_parameters(values: CalibrationResult | Mapping[str, float], problem: CalibrationProblem | None = None, sample: ParameterSample | None = None, confidence_level: float | None = None) -> AppliedParametersReport
Report every parameter of the model, and the values of its kind.
Call it on the model after apply_calibration_parameters. Each
entry carries the value the model holds and whether calibration set
it, so entries the calibration left alone appear alongside the fitted
ones. The structure of the model adds the sections of its kind
(ModelStructure.report_sections); an aggregate model adds
initial_amounts and category_splits.
Parameters that are not a single number, such as a formula or a
series, are omitted: they are inputs rather than fitted values.
factor and noise parameters have no place in the model, so
they are reported from problem when it is given.
initial_amounts gives each bin and each overridden compartment of
an aggregate model its amount the engine builds and the unit
of its bin, so bins of different units are reported side by side; no
row is a share of a total. A bin left uncalibrated keeps a None
amount as its "needs calibration" marker even when overrides touch
some of its compartments. category_splits gives each category its
fraction of the group it splits, and that group: the
categories a conditional stratification is conditioned on, empty when
it splits every bin.
With a sample each entry gains an interval holding the weighted
statistics of its draws (ParameterSample.summary). Every entry is in
the unit it was calibrated in: a parameter in its own, an amount in
the unit of its bin, and a category split as a fraction of its group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
CalibrationResult | Mapping
|
The calibration result, or a mapping of parameter id to value such as one draw of a sample. |
required |
problem
|
CalibrationProblem | None
|
The problem the values came from, used to report factor and noise parameters. |
None
|
sample
|
ParameterSample | None
|
Draws of the parameters, such as the sample of an uncertainty method. |
None
|
confidence_level
|
float | None
|
Confidence level of the intervals; required with a sample. |
None
|
Returns:
| Type | Description |
|---|---|
AppliedParametersReport
|
Key |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a sample is given without a confidence level. |
Source code in commol/context/model.py
report ¶
report(positions: Sequence[float], window: float, windows: int, observed_data: Iterable[ObservedDataPoint] = (), accumulators: Iterable[str] = (), prediction_intervals: PredictionIntervals | None = None) -> SimulationReport
Report the observed data, compartment series and accumulators of the run.
The blocks share one window axis, so the observed values, the windowed accumulator increments and the sampled series can be read against each other. Add whatever envelope you need around them, such as a run label, axis labels or summary figures in the terms of your domain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
positions
|
Sequence[float]
|
Positions the series and cumulative accumulators are sampled at; each must be a position of the results. |
required |
window
|
float
|
Length of one window on the axis. |
required |
windows
|
int
|
Number of windows on the observed and windowed axes. |
required |
observed_data
|
Iterable[ObservedDataPoint]
|
The calibration targets to report alongside the run. |
()
|
accumulators
|
Iterable[str]
|
Accumulator ids to report; their outputs come from |
()
|
prediction_intervals
|
PredictionIntervals | None
|
Prediction intervals of a conformal method
( |
None
|
Returns:
| Type | Description |
|---|---|
SimulationReport
|
Keys |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the results have no value at a position the report reads, or
they have no |
KeyError
|
If an accumulator is not a bin or accumulator of the model. |
Source code in commol/api/results.py
report ¶
report(confidence_level: float, positions: Sequence[float], window: float, windows: int, observed_data: Iterable[ObservedDataPoint] = (), accumulators: Iterable[str] = (), prediction_intervals: PredictionIntervals | None = None) -> SimulationReport
Report the replicates as SimulationResults.report reports one run.
Every number becomes a {mean, median, ci_lower, ci_upper, min,
max} block, reduced replicate by replicate; the layout is the one of
the report of a run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
confidence_level
|
float
|
Confidence level of the reported intervals, strictly between 0 and 1. |
required |
positions
|
Sequence[float]
|
Positions the series and cumulative accumulators are sampled at; each must be a position of the replicates. |
required |
window
|
float
|
Length of one window on the axis. |
required |
windows
|
int
|
Number of windows on the observed and windowed axes. |
required |
observed_data
|
Iterable[ObservedDataPoint]
|
The calibration targets to report alongside the replicates. |
()
|
accumulators
|
Iterable[str]
|
Accumulator ids to report; their outputs come from |
()
|
prediction_intervals
|
PredictionIntervals | None
|
Prediction intervals of a conformal method
( |
None
|
Returns:
| Type | Description |
|---|---|
SimulationReport
|
Keys |
Raises:
| Type | Description |
|---|---|
ValueError
|
If there are no replicates, the confidence level is out of range,
the replicates have no value at a position the report reads, or
they have no |
KeyError
|
If an accumulator is not a bin or accumulator of the model. |
Source code in commol/api/results.py
report ¶
report(confidence_level: float, positions: Sequence[float], window: float, windows: int, observed_data: Iterable[ObservedDataPoint] = (), accumulators: Iterable[str] = (), prediction_intervals: PredictionIntervals | None = None) -> SimulationReport
Report the runs of the draws as SimulationResults.report reports one.
Every number becomes a {mean, median, ci_lower, ci_upper, min,
max} block, reduced draw by draw with the weights of the draws; the
layout is the one of the report of a run. Each leaf comes from the
draws only, so the report takes no point estimate. The outputs of an
accumulator come from the model of the source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
confidence_level
|
float
|
Confidence level of the reported intervals, strictly between 0 and 1. |
required |
positions
|
Sequence[float]
|
Positions the series and cumulative accumulators are sampled at;
each must be one of |
required |
window
|
float
|
Length of one window on the axis. |
required |
windows
|
int
|
Number of windows on the observed and windowed axes. |
required |
observed_data
|
Iterable[ObservedDataPoint]
|
The calibration targets to report alongside the draws. |
()
|
accumulators
|
Iterable[str]
|
Accumulator ids to report. |
()
|
prediction_intervals
|
PredictionIntervals | None
|
Prediction intervals of a conformal method
( |
None
|
Returns:
| Type | Description |
|---|---|
SimulationReport
|
Keys |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the confidence level is out of range, or the predictive has no value at a position the report reads. |
KeyError
|
If an accumulator is not a bin or accumulator of the model. |
Source code in commol/api/inference/predictive.py
report ¶
Report the identifiability of each parameter as plain data.
Returns:
| Type | Description |
|---|---|
IdentifiabilityReportData
|
|