cleverly.Provenance#

class cleverly.Provenance(cleverly_version: str, python_version: str, platform: str, created_utc: str, n: int, n_covariates: int, n_clusters: int | None, data_fingerprint: str, fold_fingerprint: str, random_state: int | None = None, run_id: str | None = None, package_versions: dict[str, str] = <factory>, protocol_fingerprint: str | None = None)[source]#

Enough to tell whether two results came from the same place.

Parameters:
cleverly_versionstr

Version of this package that produced the fit.

python_versionstr

Interpreter version.

platformstr

Operating system and machine the fit ran on.

created_utcstr

ISO timestamp of the fit.

nint

Number of observations.

n_covariatesint

Number of adjustment covariates.

n_clustersint or None

Independent clusters, or None for independent rows.

data_fingerprintstr

Digest of the outcome, treatment and covariates. Equal fingerprints mean equal inputs; different ones mean the data moved, which is usually the answer when two runs disagree.

fold_fingerprintstr

Digest of the realised fold assignment. Recorded separately from random_state because folds are not recoverable from a seed alone – they also depend on row order, on the stratification variable, and on the scikit-learn version that generated them.

Under repeats=R this covers every draw, in fit order. A repeated fit is reproducible only if all R splits are, so a digest of one of them would be stating a guarantee the fit does not make.

random_stateint or None

Seed the fit was given.

run_idstr or None

Identifier the caller supplied.

package_versionsdict of str to str

Versions of the learner libraries used.

protocol_fingerprintstr or None

Digest of the causal study protocol. None means the fit carried no record.

Methods#

Provenance.describe() → list[str][source]#

Lines for summary().

Returns:
list of str

One line per recorded fact, for a result summary to append.

classmethod Provenance.from_dict(payload: dict[str, Any]) → Provenance[source]#

Construct an instance from a serialized mapping.

Parameters:
payloaddict

A mapping as to_dict() produced.

Returns:
Provenance

The record that mapping describes.

Provenance.to_dict() → dict[str, Any][source]#

Return a JSON-compatible representation.

Returns:
dict

A JSON-compatible mapping of every reported field.

Attributes#

Provenance.protocol_fingerprint: str | None = None#
Provenance.random_state: int | None = None#
Provenance.run_id: str | None = None#
Provenance.cleverly_version: str#
Provenance.python_version: str#
Provenance.platform: str#
Provenance.created_utc: str#
Provenance.n: int#
Provenance.n_covariates: int#
Provenance.n_clusters: int | None#
Provenance.data_fingerprint: str#
Provenance.fold_fingerprint: str#
Provenance.package_versions: dict[str, str]#