classification_threshold#
- empulse.metrics.classification_threshold(y_true, y_score, customer_threshold)[source]#
Return classification threshold for given customer threshold.
- Parameters:
- y_true1D array-like, shape=(n_samples,)
Binary target values (‘positive’: 1, ‘negative’: 0).
- y_score1D array-like, shape=(n_samples,)
Target scores, can either be probability estimates or non-thresholded decision values.
- customer_thresholdfloat
Customer threshold determined by value-driven metric.
- Returns:
- thresholdfloat
Classification threshold for given customer threshold.
Examples
>>> from empulse.metrics import classification_threshold >>> from empulse.metrics import empc >>> 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] >>> score, threshold = empc(y_true, y_score) >>> classification_threshold(y_true, y_score, threshold) 0.2