load_churn_tv_subscriptions#
- empulse.datasets.load_churn_tv_subscriptions(*, backend)[source]#
Load the TV Subscription Churn dataset (binary classification).
The goal is to predict whether a customer will churn or not. The target variable is whether the customer churned, ‘yes’ = 1 and ‘no’ = 0.
This dataset is from a TV cable provider containing all 9410 customers active during the first semester of 2014. Feature names are anonymized to protect the privacy of the customers.
For additional information about the dataset, consult the User Guide.
Classes
2
Churners
455
Non-churners
8955
Samples
9410
Features
45
- Parameters:
- backendmodule
Dataframe library to use for
dataandtarget. Pass the library module directly, e.g.backend=polarsorbackend=pandas.
- Returns:
- dataset
Dataset instance_costscontains the precomputed per-customer costs:tp_cost,fp_cost,tn_cost,fn_cost.
- dataset
Notes
The per-instance costs stored in the dataset were derived from the churn retention cost model of Bahnsen et al. (2015). The individual cost drivers (CLV, incentive cost, contact cost, acceptance probability) are not stored; only the final computed values are available.
References
[1]A. Correa Bahnsen, D.Aouada, B, Ottersten, “A novel cost-sensitive framework for customer churn predictive modeling”, Decision Analytics, 2:5, 2015.
Examples
import numpy as np import pandas as pd from empulse.datasets import load_churn_tv_subscriptions from empulse.metrics import Metric, Cost dataset = load_churn_tv_subscriptions(backend=pd) # replace with your own model's predicted probabilities y_score = np.random.default_rng(0).uniform(size=len(dataset.target)) metric = Metric(dataset.cost_matrix, Cost()) score = metric(dataset.target, y_score, **dataset.instance_costs)