cleverly.ValidationReport#

class cleverly.ValidationReport(items: tuple[AssessmentItem, ...], backend: str | None = None)[source]#

Collect results from the inexpensive validation battery.

Parameters:
itemstuple of AssessmentItem

Validation checks and their statuses.

backendstr or None

Dataframe backend used by to_frame() when data is omitted.

See also

DiagnosticReport

The combined run, which may retarget or refit.

cleverly.estimators.TMLEResult

Carries the artifacts this battery reads.

cleverly.validation.score_check

One of the checks the battery runs.

Notes

The default battery reads stored artifacts. It does not refit nuisance models.

Examples

>>> from sklearn.linear_model import LinearRegression, LogisticRegression
>>> from cleverly import ATE, CausalStudy, PointTreatment
>>> from cleverly.datasets import make_linear_ate
>>> frame, _ = make_linear_ate(n=200, seed=0)
>>> study = CausalStudy(
...     frame,
...     design=PointTreatment(
...         outcome="Y", treatment="A", adjustment=("W1", "W2", "W3", "W4")
...     ),
... )
>>> result = study.identify(ATE()).estimate(
...     outcome_learner=LinearRegression(),
...     treatment_learner=LogisticRegression(max_iter=1000),
...     cross_fit=False,
...     random_state=0,
... )
>>> report = result.validate()
>>> len(report.items) > 0
True

Methods#

ValidationReport.summary() → str[source]#

Return a printable summary.

Returns:
str

A printable table, one line per validation check.

ValidationReport.to_frame(data: Any = None) → Any[source]#

Return validation items as a dataframe.

Parameters:
dataAny

Optional dataframe whose backend selects the output type.

Returns:
Any

A pandas or Polars dataframe with one row per check.

Attributes#

ValidationReport.backend: str | None = None#
ValidationReport.passed#

Return whether every required check passed.

ValidationReport.items: tuple[AssessmentItem, ...]#