cleverly.datasets.make_contact_schedules#

cleverly.datasets.make_contact_schedules(n: int = 1000, *, seed: int | Generator | None = None, tilts: Mapping[str, Mapping[str, float]] | None = None, backend: Literal['pandas', 'polars'] | str | None = None) → tuple[Any, dict[str, float]][source]#

Draw discharges with a three-level contact schedule and a bounded transition score.

Parameters:
nint

Number of discharges.

seedint, Generator, or None

Seed or NumPy random generator.

tiltsmapping or None

The odds tilts whose exact means the truth reports, as in contact_schedules_truth(). The first tilt is the reference.

backend{“pandas”, “polars”, “pyarrow”} or None, default=None

Dataframe backend. None uses pandas when installed, then the first available backend.

Returns:
dataframe

One row per discharge: transition_score (in 0 to 1), cadence ("low", "medium" or "high"), discharge_risk, age and baseline_support_need.

truthdict of str to float

The exact values of contact_schedules_truth() for tilts.

See also

cleverly.datasets.contact_schedules_truth

The exact mean score under an odds tilt.

cleverly.datasets.navigation_protocol

The protocol of the program these data describe.

Notes

Patients with a higher discharge_risk get the more intensive schedules more often and score lower, so a plain comparison of the schedules is confounded. The module docstring gives the law.

Examples

>>> from cleverly.datasets import make_contact_schedules
>>> frame, truth = make_contact_schedules(n=500, seed=3)
>>> frame.shape
(500, 5)
>>> sorted(frame["cadence"].unique())
['high', 'low', 'medium']