make_objective_aec#
- empulse.metrics.make_objective_aec(model, *, tp_cost=0.0, tn_cost=0.0, fn_cost=0.0, fp_cost=0.0)[source]#
Create an objective function for the Average Expected Cost (AEC) measure.
The objective function presumes a situation where leads are targeted either directly or indirectly. Directly targeted leads are contacted and handled by the internal sales team. Indirectly targeted leads are contacted and then referred to intermediaries, which receive a commission. The company gains a contribution from a successful acquisition.
Read more in the User Guide.
- Parameters:
- model{‘xgboost’, ‘lightgbm’, ‘catboost’, ‘cslogit’}
The model for which the objective function is created.
‘xgboost’ :
xgboost.XGBClassifier
‘lightgbm’ :
lightgbm.LGBMClassifier
‘catboost’ :
catboost.CatBoostClassifier
‘cslogit’ :
CSLogitClassifier
- tp_costfloat or np.array, shape=(n_samples,), default=0.0
Cost of true positives. If
float
, then all true positives have the same cost. If array-like, then it is the cost of each true positive classification.- fp_costfloat or np.array, shape=(n_samples,), default=0.0
Cost of false positives. If
float
, then all false positives have the same cost. If array-like, then it is the cost of each false positive classification.- tn_costfloat or np.array, shape=(n_samples,), default=0.0
Cost of true negatives. If
float
, then all true negatives have the same cost. If array-like, then it is the cost of each true negative classification.- fn_costfloat or np.array, shape=(n_samples,), default=0.0
Cost of false negatives. If
float
, then all false negatives have the same cost. If array-like, then it is the cost of each false negative classification.
- Returns:
- objectiveCallable
A custom objective function for the specified model.
References
[1]Höppner, S., Baesens, B., Verbeke, W., & Verdonck, T. (2022). Instance-dependent cost-sensitive learning for detecting transfer fraud. European Journal of Operational Research, 297(1), 291-300.
Examples
from xgboost import XGBClassifier from empulse.metrics import make_objective_aec objective = make_objective_aec('xgboost', fp_cost=1, fn_cost=1) clf = XGBClassifier(objective=objective, n_estimators=100, max_depth=3)