empb_score#

empulse.metrics.empb_score#

Expected Maximum Profit Measure for B2B Customer Churn (EMPB).

EMPB presumes a situation where identified churners are contacted and offered an incentive to remain customers. Only a fraction of churners accepts the incentive offer, this fraction is described by a \(Beta(\alpha, \beta)\) distribution. As opposed to empc_score, the incentive cost is a fraction of the customer lifetime value, rather than a fixed value. For detailed information, consult the paper [1].

clv is required and should be a 1D array-like with one value per sample. The contact cost is incurred whenever a churner is contacted, regardless of whether they accept the incentive offer; only the retention benefit net of the incentive cost is contingent on acceptance. See auepc_score for the area under the expected profit curve.

Methods

__call__(y_true, y_score, *, clv, alpha=6, beta=14, incentive_fraction=0.05, contact_cost=15)

Compute the expected maximum profit that can be achieved by a classifier at its optimal decision threshold.

optimal_threshold(y_true, y_score, *, clv, alpha=6, beta=14, incentive_fraction=0.05, contact_cost=15)

Compute the classification threshold that maximizes the expected profit.

optimal_rate(y_true, y_score, *, clv, alpha=6, beta=14, incentive_fraction=0.05, contact_cost=15)

Compute the predicted positive rate (fraction of the customer base that should be targeted) at which the maximum expected profit is achieved.

References

[1]

Janssens, B., Bogaert, M., Bagué, A., & Van den Poel, D. (2022). B2Boost: Instance-dependent profit-driven modelling of B2B churn. Annals of Operations Research, 1-27.

Examples

from empulse.metrics import empb_score

y_true = [0, 1, 0, 1, 0, 1, 0, 1]
y_score = [0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.8, 0.9]
clv = [100, 200, 150, 300, 120, 250, 180, 220]
empb_score(y_true, y_score, clv=clv, alpha=6, beta=14, incentive_fraction=0.05, contact_cost=15)