cleverly.targeting_curves.TargetingCurve#
- class cleverly.targeting_curves.TargetingCurve(score: str, compare: str | None, route: str, n_train: int | None, n_eval: int, grid: tuple[float, ...], estimates: dict[str, list[~typing.Any]], ate: float, critical_value: float, n_half_samples: int, alpha: float, status: str, status_reason: str, backend: str | None = None, span: dict[str, float] = <factory>, evaluation: ~cleverly.targeting_curves.TargetingEvaluation | None = None, fit: ~typing.Any = None, score_curve: ~typing.Any = None)[source]#
How much treating by a priority score first gains over treating at random.
- Parameters:
- score
str The ranked score’s name.
- compare
strorNone The second score of a paired comparison, or
None.- route{“external”, “split”}
"external": a study column fitted on other rows."split": a curve refitted on a declared training split and evaluated on the other rows.- n_train
intorNone Rows of the training part on the split route;
Noneon the external route.- n_eval
int Evaluation rows.
- grid
tupleoffloat The treated fractions.
- estimates
dictofstrtolist One entry per column of
COLUMNS, one row per estimate: the TOC and the gain at each grid point, the group effects, the AUTOC and the Qini, for each score and, with a comparison, their differences under the name"<score> - <compare>".- ate
float The average effect, read from the fluctuation’s own constant column, so that each TOC equals its top-fraction mean minus this value exactly.
- critical_value
float The sup-t critical value of the band over the grid points below 1, or
nanwhen the band is withheld.- n_half_samples
int Half-sample draws.
- alpha
float Intervals hold at
1 - alpha; the band jointly.- status{“supported”, “experimental”}
The worst status of the rows.
- status_reason
str Every reason that applies, or the empty string.
- backend
strorNone The dataframe backend of the study’s data.
- span
dictofstrtofloat The fluctuation’s basis:
columns(weight columns),rank(basis directions),out_of_span(the largest relative component of a column outside the basis) andscore_norm(the largest score equation after targeting).- evaluation
TargetingEvaluation The evaluation rows the draws read.
- fit
TMLEResult The ATE fit on the evaluation rows whose nuisances the curve targets.
- score_curve
EffectCurveResultorNone On the split route, the curve refit on the training rows whose predictions are the score;
Noneon the external route.
- score
Methods#
- TargetingCurve.area(quantity: str = 'autoc', score: str | None = None) dict[str, Any][source]#
The row of one area.
- TargetingCurve.plot(view: str = 'toc', **kwargs: Any) Any[source]#
Draw the curve with
cleverly.plotting.targeting().- Parameters:
- view{“toc”, “gain”, “difference”}
Which view to draw.
- **kwargs
Any Passed to
cleverly.plotting.targeting().
- Returns:
FigureThe figure drawn on.
- TargetingCurve.rows(quantity: str, score: str | None = None) list[dict[str, Any]][source]#
The rows of one quantity of one score, in grid order.