BinaryOutcome

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class BinaryOutcome(column: str, positive_label: Any = 1)[source]

Bases: object

Two-class endpoint, e.g. treatment response or 2-year recurrence.

column

Column holding the class label.

Type:

str

positive_label

Value denoting the POSITIVE class. Made explicit because sensitivity, PPV, ROC and decision-curve analysis are all defined relative to it, and inferring it from the data (largest label? most frequent? sorted last?) silently flips those metrics whenever the coding changes.

Type:

Any

__post_init__() → None[source]

Validate the column name.

property columns: Tuple[str, ...]

Return the single label column.

positive_mask(frame: DataFrame) → Series[source]

Return a boolean mask marking the positive class.

Parameters:

frame – Frame carrying column.

Returns:

Boolean Series aligned to frame, true where the label equals positive_label.

__init__(column: str, positive_label: Any = 1) → None