Labels¶
Defines the prediction target: which entities, at what times, and what outcome.
Labels(*, path=None, df=None, keys, label_time, target)
¶
Prediction targets with entity keys and event times.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path | None
|
Path to the labels file. |
None
|
df
|
Any
|
DataFrame with labels (mutually exclusive with path). |
None
|
keys
|
str | list[str]
|
Column name(s) used as entity keys. |
required |
label_time
|
str
|
Column name containing the label event time. |
required |
target
|
str | list[str]
|
Column name(s) for the prediction target. |
required |
Source code in src/timefence/core.py
Parameters¶
| Parameter | Type | Description |
|---|---|---|
path |
str \| Path \| None |
Path to labels file (Parquet). Mutually exclusive with df. |
df |
Any \| None |
DataFrame, DuckDB relation, or any object with a compatible interface. Mutually exclusive with path. |
keys |
str \| list[str] |
Entity key column(s). Must match the keys used in features. |
label_time |
str |
Column name for the label event timestamp. |
target |
str \| list[str] |
Prediction target column(s) (e.g., "churned"). |