Capability#

class empulse.metrics.Capability(*values)[source]#

A capability a MetricStrategy may or may not support.

A plain Enum, not a StrEnum: nothing here relies on a member behaving like a str, and the reference docs generate one page per class with :inherited-members:, which would otherwise enumerate (and try to numpydoc-validate) the entire inherited str method surface – .zfill(), .translate(), and so on.

Attributes:
OPTIMAL_THRESHOLDCapability

optimal_threshold is implemented.

OPTIMAL_RATECapability

optimal_rate is implemented.

LOGIT_OBJECTIVECapability

logit_objective is implemented.

BOOST_OBJECTIVECapability

gradient_boost_objective is implemented: the gradient and hessian can be recomputed directly from the metric on every boosting round.

PRECOMPUTED_BOOST_OBJECTIVECapability

prepare_boost_objective is implemented: the gradient’s constant term can be computed once, before the first boosting round, rather than recomputed every round. Mutually exclusive with BOOST_OBJECTIVE in practice, since a strategy that needs BOOST_OBJECTIVE’s dynamic recomputation (its per-sample loss is non-linear in the predicted probability, or it needs the current round’s scores to locate a threshold) cannot also offer a round-independent constant term.

COST_ONLY_DECISIONCapability

optimal_threshold and optimal_rate depend only on the cost values, not on the actual y_true/y_score – they can be called with empty or dummy arrays, which is what lets a decision be recomputed at predict time from cost parameters alone rather than only from what was learned during fit. Absent for a ranking-based strategy (e.g. MaxProfit), whose threshold is a genuine function of the observed scores.

CLASS_COSTSCapability

The metric is reducible to four class-level scalars (tp_benefit, tn_benefit, fp_cost, fn_cost), which is what a model needs to feed a cost-sensitive criterion (e.g. a decision tree’s split criterion) that only accepts scalar, class-dependent costs.