mpa_score#
- empulse.metrics.mpa_score#
Maximum Profit measure for customer Acquisition (MPA).
MPA 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.
See
empa_scorefor a stochastic version of this metric.Methods
All three methods take
y_trueandy_score, followed by the keyword-only parameterscontribution=8000,contact_cost=50,sales_cost=500,direct_selling=1andcommission=0.1.__call__(y_true, y_score, **parameters)Compute the maximum profit that can be achieved by a classifier at its optimal decision threshold.
optimal_threshold(y_true, y_score, **parameters)Compute the classification threshold that maximizes the profit.
optimal_rate(y_true, y_score, **parameters)Compute the predicted positive rate (fraction of leads that should be targeted) at which the maximum profit is achieved.
Examples
from empulse.metrics import mpa_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] mpa_score(y_true, y_score, direct_selling=1)