credibility.assessment¶
The assessment of the contexts of use of a model as plain data.
assess evaluates the adopted fits of a project (evaluate_fits) and assesses
its declaration on their data points, assess_table does the same on a given
table without a project. Per context of use:
- The metrics of every evidence: the points, mappings and studies,
criteria_metricsand the values of the acceptance rules of the context. - The acceptance: the rules on the union of the points of the decisive
evidence (
ContextOfUse.decisive_role, calibration for C1, else validation), each row of the table once, followed by the rules of the evidence extensions of the project (sbmlsim.credibility.extensions.ContextContribution.acceptance), each row with the name of its extension. - The coverage of every claimed value of the domain:
validatedwith applicable points of validation evidence,calibratedwith applicable points of calibration evidence only,uncoveredwithout; a C1 context countscalibratedas covered. A point is applicable when the fold criteria can evaluate it, a positive and finite value and prediction (applicable): the points of a failed simulation or of zeros cover nothing. The values of the points outside the claimed domain are reported as unclaimed values, a point without the field has none. - The coverage of every quantity of interest:
coveredwith an applicable decisive point of its observable inside the claimed domain (every claimed field of the point has a claimed value),uncoveredwithout; a ratio quantity with a pairing by the points its extension derives (ContextContribution.quantities), a declared ratio without a pairing has no coverage. - The minimum of evaluable points,
ContextOfUse.minimum_points. - The verification of the decisive predictions, when the assessment is
verified (
sbmlsim.credibility.verification): per check whether it passed, the largest relative difference of the alternative predictions and whether the acceptance changes with them, and the checks of the battery of the variants of the model (sbmlsim.credibility.battery), the same for every context. - The parameter uncertainty and the predictive check with the variability of
the subjects of the decisive predictions, when they ran
(
sbmlsim.credibility.uncertainty,sbmlsim.credibility.variability). - The verdict, see
verdict, and the factors of V&V 40 (FACTORS), the statements of the extensions combined with the ones of the core (sbmlsim.credibility.factors.combine_factor). - The sections of the extensions, which the extensions write and read
(
ContextResult.extensions,CredibilityAssessment.extensions).
The statement of the domain is recorded and shown, not assessed. The
limitations are reported apart, with their metrics, and enter no acceptance.
The assessment writes and reads JSON (to_json, from_json), with NaN as
null; it reads the records of pkpdsim 0.17 to 0.19 as well, whose evidence
of the extensions is read as their sections
(sbmlsim.credibility.extensions.read_sections).
Verdict
¶
Bases: StrEnum
The verdict of the assessment of a context of use.
Coverage
¶
Bases: StrEnum
The coverage of a claimed value of the domain of a context of use.
QuantityRecord
¶
Bases: TypedDict
A quantity of interest as plain data, see QuantityOfInterest.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
the id of the quantity. |
description |
str
|
what the quantity is. |
ratio |
bool
|
whether the quantity is a ratio between arms. |
coverage |
str | None
|
|
n_points |
int
|
the applicable decisive points of the quantity inside the claimed domain, the points the extension derives for a ratio with a pairing, 0 for a ratio without one. |
AcceptanceRecord
¶
Bases: TypedDict
The result of an acceptance rule as plain data, see AcceptanceResult.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
the name of the rule. |
value |
float
|
its value, |
limit |
str
|
its limit in words. |
met |
bool | None
|
whether it is met, |
extension |
NotRequired[str]
|
the name of the evidence extension of the rule, absent for
a rule of the context, see
|
UnclaimedRecord
¶
Bases: TypedDict
The unclaimed validation points of a fit mapping.
Attributes:
| Name | Type | Description |
|---|---|---|
fit |
str
|
the subset of the fit. |
experiment |
str
|
the experiment. |
mapping |
str
|
the key of the mapping. |
n |
int
|
the points. |
EvidenceResult
dataclass
¶
EvidenceResult(
*,
context,
name,
role,
description,
selection,
n_points,
n_mappings,
n_studies,
outliers_dropped,
limitation_subtracted,
metrics,
)
The metrics of an evidence of a context of use or of a limitation.
Attributes:
| Name | Type | Description |
|---|---|---|
context |
str
|
the id of the context of use, |
name |
str
|
the name of the evidence. |
role |
EvidenceRole
|
the role of the evidence. |
description |
str
|
what the evidence is. |
selection |
str
|
what the evidence selects, see |
n_points |
int
|
the data points. |
n_mappings |
int
|
the fit mappings, by experiment and key. |
n_studies |
int
|
the studies, the experiments of the mappings. |
outliers_dropped |
int
|
the outlier points a validation dropped. |
limitation_subtracted |
int
|
the limitation points subtracted. |
metrics |
dict[str, float]
|
|
CoverageEntry
dataclass
¶
The coverage of a value of a field of the metadata by a context of use.
Attributes:
| Name | Type | Description |
|---|---|---|
context |
str
|
the id of the context of use. |
field |
str
|
the field of the metadata, e.g. |
value |
str
|
the name of the value, e.g. |
coverage |
Coverage | None
|
the coverage of a claimed value, |
claimed |
bool
|
whether the domain claims the value; the values of the points of the evidence outside the claim are not claimed. |
n_points |
int
|
the points with the value: the applicable points of the validation evidence for a validated value, of the calibration evidence for a calibrated one, every point of the evidence for a value outside the claim. |
ContextResult
dataclass
¶
ContextResult(
*,
id,
title,
question,
level,
influence,
consequence,
risk,
rationale,
extrapolation,
domain_statement,
quantities,
acceptance,
verdict,
factors,
n_decisive,
n_evaluable,
minimum_points,
verification=list(),
uncertainty=None,
variability=None,
extensions=dict(),
)
The assessment of a context of use.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
the id of the context. |
title |
str
|
the title. |
question |
str
|
the question. |
level |
CouLevel
|
the level on the ladder. |
influence |
Level
|
the influence of the model on the decision. |
consequence |
Level
|
the consequence of a wrong decision. |
risk |
Level
|
the model risk. |
rationale |
str
|
why this level, influence and consequence. |
extrapolation |
str
|
the argument for a domain without validation evidence. |
domain_statement |
str
|
what the domain claims beyond the metadata. |
quantities |
list[QuantityRecord]
|
the quantities of interest ( |
acceptance |
list[AcceptanceRecord]
|
the results of the acceptance rules ( |
verdict |
Verdict
|
the verdict. |
factors |
list[FactorRecord]
|
the factors of V&V 40 ( |
n_decisive |
int
|
the points of the decisive evidence, each row once. |
n_evaluable |
int
|
the decisive points which are applicable, see
|
minimum_points |
int
|
the evaluable points the verdict needs, see
|
verification |
list[CheckRecord]
|
the checks of the verification of the decisive predictions, the checks of the predictions followed by the checks of the battery; empty if the assessment was not verified. |
uncertainty |
UncertaintyRecord | None
|
the parameter uncertainty of the decisive predictions,
see |
variability |
VariabilityRecord | None
|
the predictive check of the decisive points with the
declared variability of the subjects, see
|
extensions |
dict[str, Any]
|
the sections of the evidence extensions by their name,
plain data which the extension of that name reads, see
|
decisive_role
property
¶
Get the role of the evidence which decides, see CouLevel.decisive_role.
uncovered_quantities
property
¶
Get the ids of the quantities of interest which are uncovered.
section
¶
Get the section of an extension, None without one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the name of the extension. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The section as plain data. |
from_dict
classmethod
¶
Get the result from plain data, None as NaN.
A record of pkpdsim 0.17 has no minimum of points, read as 0, and no
coverage of the quantities, read as None with 0 points; a record of
0.18 or earlier has no verification, no uncertainty and no predictive
check; a record of 0.19 has the evidence of its extensions as fields
of its own, read as their sections, and the rule of its ratio pairs as
a field, read as a row of the acceptance, see
sbmlsim.credibility.extensions.read_sections and read_acceptance.
Provenance
dataclass
¶
What an assessment was computed from.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
the name of the project of the model. |
title |
str
|
the title of the model. |
fits |
list[str]
|
the ids of the adopted fits. |
versions |
dict[str, str]
|
the versions of the packages, see |
commit |
str | None
|
the commit of the repository of the model, |
dirty |
bool | None
|
whether the repository has changes, |
date |
str
|
the date of the assessment, ISO 8601 with the time zone. |
lock |
str | None
|
whether the evidence matched the lock of the declaration
( |
CredibilityAssessment
dataclass
¶
CredibilityAssessment(
*,
provenance,
contexts,
evidence,
coverage,
limitations,
unclaimed,
notes,
verification=None,
cross_validations=list(),
vpc=list(),
extensions=dict(),
)
The assessment of the contexts of use of a model.
Attributes:
| Name | Type | Description |
|---|---|---|
provenance |
Provenance
|
what the assessment was computed from. |
contexts |
list[ContextResult]
|
the result of every context of use, in the declared order. |
evidence |
list[EvidenceResult]
|
the metrics of every evidence of every context. |
coverage |
list[CoverageEntry]
|
the coverage of the domain of every context. |
limitations |
list[EvidenceResult]
|
the metrics of the limitations, of the model (context
|
unclaimed |
list[UnclaimedRecord]
|
the validation points which no evidence and no limitation
selects, per fit and mapping ( |
notes |
str
|
the notes of the declaration. |
verification |
VerificationSummary | None
|
what the verification compared, |
cross_validations |
list[CrossValidation]
|
the leave-one-study-out cross-validations of the
adopted fits, see |
vpc |
list[VpcPoint]
|
every data point of the adopted fits with the band of its
predictive check, see |
extensions |
dict[str, Any]
|
the sections of the evidence extensions in the assessment by their name, plain data, e.g. the provenance of the data of every study; a record of pkpdsim 0.19 has them as fields of its own, read as their sections. |
context
¶
Get the result of a context of use.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context_id
|
str
|
the id of the context. |
required |
Returns:
| Type | Description |
|---|---|
ContextResult
|
The result. |
Raises:
| Type | Description |
|---|---|
KeyError
|
for an unknown context. |
to_json
¶
Write the assessment as JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
the file. |
required |
from_json
classmethod
¶
Read an assessment written with to_json, or by pkpdsim 0.17 to 0.19.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
the file. |
required |
Returns:
| Type | Description |
|---|---|
CredibilityAssessment
|
The assessment. |
describe_selection
¶
Describe what a selection of an evidence selects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection
|
Selection
|
the selection. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The mapping keys by study for a |
str
|
|
str
|
|
str
|
|
str
|
the description of its filter; the qualified name otherwise. |
applicable
¶
Get the points the fold criteria can evaluate.
The predicate of the ratio criteria of sbmlsim (Fold, GMFE, AFE): a
positive and finite value (DV) and prediction (IPRED).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
DataFrame
|
the data points. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
The applicable points. |
verdict
¶
verdict(
n_decisive,
acceptance,
covered,
extrapolation,
*,
level,
n_evaluable,
minimum,
verified=None,
)
Get the verdict of a context of use.
In this order: no decisive point is insufficient evidence; a failed check of the verification is not verified, since the comparison of the predictions with the data is not to be trusted; a rule which is not met is not supported, also on few points; a rule which is not evaluable is insufficient evidence; fewer evaluable points than the minimum is insufficient evidence; every claimed value and every quantity with a coverage covered is supported, for C4 supported with extrapolation (a C4 context extrapolates without data of its condition by definition, its extrapolation argument is required); an extrapolation argument is supported with extrapolation; else insufficient evidence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_decisive
|
int
|
the points of the decisive evidence. |
required |
acceptance
|
Sequence[AcceptanceResult]
|
the results of the acceptance rules, of the context and of the extensions. |
required |
covered
|
bool
|
whether every claimed value and every quantity with a coverage is covered. |
required |
extrapolation
|
str
|
the extrapolation argument of the context. |
required |
level
|
CouLevel
|
the level of the context. |
required |
n_evaluable
|
int
|
the decisive points which are applicable. |
required |
minimum
|
int
|
the evaluable points the verdict needs. |
required |
verified
|
bool | None
|
whether every check of the verification passed, |
None
|
Returns:
| Type | Description |
|---|---|
Verdict
|
The verdict. |
assess_table
¶
assess_table(
credibility,
fits,
provenance,
verification=None,
cross_validations=(),
propagation=None,
variability=None,
*,
extensions=(),
prepared=None,
)
Assess the contexts of use of a declaration on the data points of the fits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
credibility
|
Credibility
|
the declaration. |
required |
fits
|
FitTable
|
the data points of the adopted fits with |
required |
provenance
|
Provenance
|
what the table was computed from. |
required |
verification
|
Verification | None
|
the alternative predictions of the table and the issues
of the variants, see |
None
|
cross_validations
|
Sequence[CrossValidation]
|
the cross-validations of the adopted fits, which assess the factor model form. |
()
|
propagation
|
FitPropagation | None
|
the predictions at the draws of the parameters of the
fits, see |
None
|
variability
|
PredictiveChecks | None
|
the predictive checks of the fits with the declared
variability, see |
None
|
extensions
|
Sequence[EvidenceExtension]
|
the evidence extensions of the project, in their order. |
()
|
prepared
|
Mapping[str, object] | None
|
what every extension prepared ( |
None
|
Returns:
| Type | Description |
|---|---|
CredibilityAssessment
|
The assessment. |
Raises:
| Type | Description |
|---|---|
SelectionError
|
if the evidence selects invalid data, see |
provenance
¶
Get the provenance of an assessment of a project now.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
the project. |
required |
source_commit
|
str | None
|
the commit of the source repository of the model, given by a release, which assesses the model in its release repository: the commit is recorded and whether its tree was clean is not known. |
None
|
lock
|
str | None
|
the state of the lock of the evidence, see |
None
|
Returns:
| Type | Description |
|---|---|
Provenance
|
The versions of |
Provenance
|
extensions and the battery hook of the project, the commit and |
Provenance
|
whether the root of the project has changes |
Provenance
|
( |
Provenance
|
repository, the dirty state |
Provenance
|
adopted fits, the date with the local time zone and the state of the |
Provenance
|
lock. |
assess
¶
assess(
project,
source_commit=None,
*,
verification=True,
battery=True,
cross_simulator=True,
lock=None,
uncertainty=None,
variability=None,
cross_validations=None,
)
Assess the contexts of use of a project on its adopted fits.
The fits are evaluated fresh on the current model and data, see
evaluate_fits, and, with verification, again with the alternatives of
the checks of sbmlsim.credibility.verification; the cross-validations of
the adopted fits are read, and every evidence extension of the project
prepares what it reads once (EvidenceExtension.prepare).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
the project with a declaration and adopted fits. |
required |
source_commit
|
str | None
|
the commit of the source repository of a release, see
|
None
|
verification
|
bool
|
verify the decisive predictions; the factors of the verification are not assessed without. |
True
|
battery
|
bool
|
run the battery of the checks of the variants with the
verification, see |
True
|
cross_simulator
|
bool
|
run the check |
True
|
lock
|
Path | None
|
write the lock of the evidence ( |
None
|
uncertainty
|
PropagationSettings | None
|
propagate the parameter uncertainty of the adopted fits
to the decisive predictions with these settings, see
|
None
|
variability
|
VariabilitySettings | None
|
check the decisive points with the declared variability
of the subjects ( |
None
|
cross_validations
|
Mapping[str, CrossValidation] | None
|
the cross-validations of the adopted fits by their
subset, the ones of the records of the project
( |
None
|
Returns:
| Type | Description |
|---|---|
CredibilityAssessment
|
The assessment. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no declaration or no adopted fits, or the settings of the variability are given for a declaration without a variability. |
KindMismatchError
|
if a kind differs from the recorded one. |
SelectionError
|
if the evidence selects invalid data. |
LockMismatchError
|
if the evidence differs from the lock. |