Skip to content

credibility.selection

The data points of the evidence of the contexts of use of a model.

select applies the declaration (Credibility) to the table of the adopted fits (FitTable): the points of every evidence, the limitation points and the validation points which no evidence claims. Everything is keyed by the experiment and the key of a mapping, never by the key alone, which two studies can share. The rules:

  • A mapping which is training data of one adopted fit is fitted data in every fit: its points in another fit, where it may be validation data, are no validation either.
  • The quantities of a context of use restrict its evidence to their observables, compared without the brackets of a concentration ([A] is A); an assessed ratio quantity by the observable of its arms, a declared ratio without a pairing restricts nothing.
  • The evidence extensions check the decisive points of every context of use (sbmlsim.credibility.extensions.EvidenceExtension.selection_problems), e.g. a study of a ratio with more than one reference arm is an error.
  • The limitations, of the model and of every context, are data the model does not describe: they are subtracted from every other evidence of every context and counted; a limitation of fitted data is an error.
  • A validation of fitted data is an error, its outliers are dropped and counted.
  • A calibration keeps the fitted points of its selection, it counts the subtracted limitation points it would have kept.
  • Unclaimed takes the validation points which no limitation and no other evidence of any context selects; two Unclaimed of different contexts may take the same points.
  • An evidence which selects no point is an error, and so is an evidence of a fit the model has not adopted.

EvidenceSelection dataclass

EvidenceSelection(
    *,
    context,
    evidence,
    rows,
    outliers_dropped,
    limitation_subtracted,
)

The data points of an evidence of a context of use.

Attributes:

Name Type Description
context str

the id of the context of use.

evidence Evidence

the evidence.

rows Index

the selected rows of the table of the fits (FitTable.table).

outliers_dropped int

the points of kind outlier which a validation selected and dropped.

limitation_subtracted int

the limitation points the evidence selected and which were subtracted.

Selections dataclass

Selections(
    *,
    evidence,
    limitations,
    unclaimed,
    limitation_evidence=(),
)

The data points of the evidence of every context of use of a model.

Attributes:

Name Type Description
evidence tuple[EvidenceSelection, ...]

the selection of every evidence, in the order of the contexts and their evidence.

limitations Index

the rows of the limitations of the model and of every context.

unclaimed DataFrame

the validation points of no evidence and no limitation, with the columns fit, experiment, mapping and n (the points).

limitation_evidence tuple[EvidenceSelection, ...]

the selection of every limitation, the ones of the model first, with the context "", then the ones of the contexts.

SelectionError

SelectionError(problems)

Bases: ValueError

The evidence of a declaration selects invalid data.

Attributes:

Name Type Description
problems

every problem of the selection.

Create the error.

Parameters:

Name Type Description Default
problems list[str]

every problem of the selection.

required

normalize_observable

normalize_observable(observable)

Get an observable without the brackets of a concentration.

Parameters:

Name Type Description Default
observable str

the observable, e.g. [A], A or pk.cmax.

required

Returns:

Type Description
str

The observable, e.g. A for [A].

metadata_values

metadata_values(points, field)

Get the values of a field of the metadata of points as text.

The values are the names of the members of the enums, as the table of the fits has them (sbmlsim.fit.metrics.metadata_dict).

Parameters:

Name Type Description Default
points DataFrame

rows of the table of the fits.

required
field str

the field of the metadata, e.g. route.

required

Returns:

Type Description
Series

The values, empty for a point without the field or a table without the

Series

column.

in_domain

in_domain(cou, points)

Get the points inside the claimed domain of a context of use.

A point is inside when it has a claimed value of every claimed field; a field without claimed values claims nothing and restricts no point. The core and the extensions test the domain with it, e.g. the coverage of a quantity and the pairs of a ratio inside the domain.

Parameters:

Name Type Description Default
cou ContextOfUse

the context of use.

required
points DataFrame

rows of the table of the fits.

required

Returns:

Type Description
DataFrame

The points inside the domain, in their order.

select

select(credibility, fits, extensions=())

Select the data points of the evidence of every context of use.

A mapping (its experiment and key) which is training data of any adopted fit counts as fitted in every fit: a validation which selects its points, in any fit, is an error which names the fits it is training data of, and neither Unclaimed nor the unclaimed validation points take them. Two Unclaimed of different contexts may take the same points. See the module for the other rules.

Parameters:

Name Type Description Default
credibility Credibility

the declaration.

required
fits FitTable

the table of the adopted fits, see evaluate_fits and mapping_table.

required
extensions Sequence[EvidenceExtension]

the evidence extensions of the project, which check the decisive points of every context of use.

()

Returns:

Type Description
Selections

The points of every evidence, the limitation points and the unclaimed

Selections

validation points.

Raises:

Type Description
SelectionError

with every problem of the selection.