Capability#
- class empulse.metrics.Capability(*values)[source]#
A capability a
MetricStrategymay or may not support.A plain
Enum, not aStrEnum: nothing here relies on a member behaving like astr, and the reference docs generate one page per class with:inherited-members:, which would otherwise enumerate (and try to numpydoc-validate) the entire inheritedstrmethod surface –.zfill(),.translate(), and so on.- Attributes:
- OPTIMAL_THRESHOLDCapability
optimal_thresholdis implemented.- OPTIMAL_RATECapability
optimal_rateis implemented.- LOGIT_OBJECTIVECapability
logit_objectiveis implemented.- BOOST_OBJECTIVECapability
gradient_boost_objectiveis implemented: the gradient and hessian can be recomputed directly from the metric on every boosting round.- PRECOMPUTED_BOOST_OBJECTIVECapability
prepare_boost_objectiveis implemented: the gradient’s constant term can be computed once, before the first boosting round, rather than recomputed every round. Mutually exclusive withBOOST_OBJECTIVEin practice, since a strategy that needsBOOST_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_thresholdandoptimal_ratedepend only on the cost values, not on the actualy_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 duringfit. 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.