Labels

Warning

These functions look at future prices by design – they build supervised-learning targets (y), never features (X). Route their output through a purged / embargoed split (fynance.data.split) before training; never feed a label back into a model as an input.

The AFML (Lopez de Prado, Advances in Financial Machine Learning) labeling stack: path-dependent triple-barrier labels (triple_barrier), meta-labels for a secondary bet-sizing model (meta_labels), and overlap-aware sample weights (label_concurrency, uniqueness_weights).

Triple-barrier labeling

triple_barrier(prices[, events, pt, sl, ...])

Path-dependent triple-barrier labels (AFML ch.

meta_labels(side, labels)

Meta-label a primary side prediction against realized outcomes.

Overlap-aware sample weights

label_concurrency(t_in, t_out, T)

Number of labels alive at each bar (inclusive [t_in, t_out] spans).

uniqueness_weights(t_in, t_out, T)

Average-uniqueness sample weights for overlapping labels (AFML ch.