empulse.metrics#

The metrics module contains a collection of metrics for evaluating the performance of models in the context of customer churn, credit scoring, and acquisition.

Build your own cost-sensitive metric#

Metric

Class to create a custom value/cost-sensitive metric.

MetricStrategy

Abstract base class for metric strategies.

MaxProfit

Strategy for the Expected Maximum Profit (EMP) metric.

Cost

Strategy for the Expected Cost metric.

Savings

Strategy for the Expected Savings metric.

General Metrics#

max_profit

Maximum Profit Measure (MP).

max_profit_score

max_profit but only returning the MP score.

lift_score

Compute the lift score for the top fraction of predictions.

cost_loss

Cost of a classifier.

expected_cost_loss

Expected cost of a classifier.

expected_log_cost_loss

Expected log cost of a classifier.

make_objective_aec

Create an objective function for the Average Expected Cost (AEC) measure.

savings_score

Cost savings of a classifier compared to using a baseline.

expected_savings_score

Expected savings of a classifier compared to a baseline.

Customer Acquisition Metrics#

empa

Expected Maximum Profit measure for customer Acquisition (EMPA).

empa_score

empa but only returning the EMPA score.

mpa

Maximum Profit measure for customer Acquisition (MPA).

mpa_score

mpa but only returning the MPA score.

expected_cost_loss_acquisition

Expected cost of a classifier for customer acquisition.

make_objective_acquisition

Create an objective function for the Expected Cost measure for customer acquisition.

Customer Churn Metrics#

empc

Expected Maximum Profit Measure for Customer Churn (EMPC).

empc_score

empc but only returning the EMPC score.

mpc

Maximum Profit Measure for Customer Churn (MPC).

mpc_score

mpc but only returning the MPC score.

empb

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

empb_score

empb but only returning the EMPB score.

auepc_score

Area Under the Expected Profit Curve (AUEPC).

expected_cost_loss_churn

Expected cost of a classifier for customer churn.

make_objective_churn

Create an objective function for the Expected Cost measure for customer churn.

Credit Scoring Metrics#

empcs

Expected Maximum Profit measure for Credit Scoring.

empcs_score

empcs but only returning the EMPCS score.

mpcs

Maximum Profit measure for Credit Scoring.

mpcs_score

mpcs but only returning the MPCS score.

Helper Functions#

classification_threshold

Return classification threshold for given customer threshold.