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:
- n
int Number of discharges.
- seed
int,Generator,orNone Seed or NumPy random generator.
- tilts
mappingorNone The odds tilts whose exact means the truth reports, as in
contact_schedules_truth(). The first tilt is the reference.- backend{“pandas”, “polars”, “pyarrow”}
orNone, default=None Dataframe backend.
Noneuses pandas when installed, then the first available backend.
- n
- Returns:
dataframeOne row per discharge:
transition_score(in 0 to 1),cadence("low","medium"or"high"),discharge_risk,ageandbaseline_support_need.- truth
dictofstrtofloat The exact values of
contact_schedules_truth()fortilts.
See also
cleverly.datasets.contact_schedules_truthThe exact mean score under an odds tilt.
cleverly.datasets.navigation_protocolThe protocol of the program these data describe.
Notes
Patients with a higher
discharge_riskget 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']