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#
Metrics can be built by combining a CostMatrix with a MetricStrategy.
The cost matrix defines the costs and benefits associated with different outcomes,
while the metric strategy defines how to compute the metric based on the cost matrix and the model’s predictions.
Cost Matrix#
Class to create a custom value/cost-sensitive cost matrix. |
Metric Strategies#
Abstract base class for metric strategies. |
|
A capability a |
|
Strategy for the Expected Maximum Profit (EMP) metric. |
|
Strategy for the Minimum Cost metric. |
|
Strategy for the (empirical) maximum profit found by ranking samples by predicted score. |
|
Strategy for the Empirical Minimum Cost metric. |
|
Strategy for the Area Under the Expected Profit Curve (AUEPC) metric. |
|
Strategy for the Expected Cost metric. |
|
Strategy for the Expected Profit metric. |
|
Strategy for the Expected Log Cost metric. |
|
Strategy for the Expected Savings metric. |
Metrics#
Abstract interface shared by every metric usable as a cost-sensitive |
|
Class to create a custom value/cost-sensitive metric. |
|
One term of a |
|
A weighted linear combination ("mixture") of |
Extension Points#
Abstract base classes for writing a custom MetricStrategy. Most users
never need these.
Class to compute the loss and gradient of a logistic regression objective. |
|
Elastic-net penalty on the non-intercept coefficients of a logit objective. |
|
Compute the natural magnitude of a cost matrix's per-sample training signal. |
General Metrics#
Maximum Profit Measure (MP). |
|
Compute the lift score for the top fraction of predictions. |
|
Cost of a classifier. |
|
Expected cost of a classifier. |
|
Expected log cost of a classifier. |
|
Cost savings of a classifier compared to using a baseline. |
|
Expected savings of a classifier compared to a baseline. |
Customer Acquisition Metrics#
See Customer Acquisition Metrics for an explanation of the cost-benefit matrix.
Expected Maximum Profit measure for customer Acquisition (EMPA). |
|
Maximum Profit measure for customer Acquisition (MPA). |
|
Expected cost of a classifier for customer acquisition. |
Customer Churn Metrics#
See Customer Churn Metrics for an explanation of the cost-benefit matrix.
Expected Maximum Profit Measure for Customer Churn (EMPC). |
|
Maximum Profit Measure for Customer Churn (MPC). |
|
Expected Maximum Profit Measure for B2B Customer Churn (EMPB). |
|
Area Under the Expected Profit Curve (AUEPC). |
|
Expected cost of a classifier for customer churn. |
Credit Scoring Metrics#
See Credit Scoring Metrics for an explanation of the cost-benefit matrix.
Expected Maximum Profit measure for Credit Scoring (EMPCS). |
|
Maximum Profit measure for Credit Scoring (MPCS). |
Helper Functions#
Return classification threshold for given customer threshold. |