credibility.records¶
The data points of the adopted fits of a model with the kinds of their mappings.
The kind of a fit mapping (training, validation, outlier) decides what its
data can be evidence of: a point which was fitted is no validation. The kinds
are the ones the record of an adopted fit stores (metrics_mappings.tsv, the
kind every mapping had when the fit ran), and the current selection of the fit
definition must have the same kinds: a split changed after the adoption without
a refit would otherwise let fitted data count as validation. The remedy of a
difference is a refit and a new adoption, never an override.
evaluate_fits evaluates the adopted fits on the current model and data into
the table of their data points; mapping_table is the same table with one row
per mapping, without a simulation, for the static check of a declaration.
FitTable
dataclass
¶
The data points of the adopted fits of a model.
Attributes:
| Name | Type | Description |
|---|---|---|
table |
DataFrame
|
one row per data point ( |
lookup |
MappingLookup
|
the fit mapping of an experiment and a key. |
recorded_kinds |
Kinds
|
the kinds the records of the adopted fits store, by the subset of the fit, the experiment and the key of the mapping. |
reports |
Mapping[str, FitReport]
|
the reports the data points were evaluated with, by the
subset of the fit ( |
KindMismatchError
¶
Bases: ValueError
The kinds of the fit mappings differ from the kinds the adopted fits recorded.
Attributes:
| Name | Type | Description |
|---|---|---|
problems |
every mapping whose kind differs. |
Create the error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problems
|
list[str]
|
every mapping whose kind differs. |
required |
recorded_kinds
¶
Get the kinds of the mappings which the record of an adopted fit stores.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
Path
|
the directory of the record of the adopted fit. |
required |
fit
|
str
|
the subset of the fit, the first item of every key. |
required |
Returns:
| Type | Description |
|---|---|
dict[tuple[str, str, str], str]
|
The kind by the subset, the experiment and the key of the mapping. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
if the record has no metrics of its mappings. |
ValueError
|
if the metrics lack the experiment, the mapping or the kind, or store two kinds of one mapping. |
kind_differences
¶
Compare the kinds of the mappings of a table with the recorded kinds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
DataFrame
|
a table of the fits with the columns |
required |
recorded
|
Kinds
|
the recorded kinds, see |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
One message per mapping whose kind differs from the recorded one, or |
list[str]
|
which only the table or only the record has; empty if the kinds agree. |
adopted_ids
¶
Get the ids of the adopted fits of a project, in the order of their subsets.
The subsets are the keys of the file of the adopted fits
(Project.adopted_fits), so a subset has one adopted fit; the id of a fit
must be one of its subset (sbmlsim.fit.result.fit_subset).
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no adopted fits or a fit id is no fit of the subset it is adopted for. |
evaluate_fits
¶
Evaluate the adopted fits of a project into the table of their data points.
Every fit is evaluated fresh on the current model and data with the settings
it ran with (sbmlsim.fit.cli.report_from_records), at the reference
parameter set of its record; the kinds of its mappings must be the recorded
ones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
the project, its adopted fits are evaluated. |
required |
Returns:
| Type | Description |
|---|---|
FitTable
|
The data points of every fit with the column |
FitTable
|
report of every fit. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no adopted fits, see |
FileNotFoundError
|
if a record has no parameters or no kinds. |
KindMismatchError
|
if a kind differs from the recorded one. |
mapping_table
¶
Get the mappings of the adopted fits of a project without a simulation.
The kinds are the ones of the current selection of every fit definition;
the excluded mappings, which a fit does not evaluate, are no rows. The
recorded kinds are compared by the caller, see kind_differences.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
the project, its adopted fits are listed. |
required |
Returns:
| Type | Description |
|---|---|
FitTable
|
One row per fit and mapping with the columns of |
FitTable
|
fields of the metadata. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no adopted fits, see |
FileNotFoundError
|
if a record has no parameters or no kinds. |