Skip to content

PredictionResults

PredictionResults

The function prints the key metrics of the predicted scores against true labels.

Parameters:

  • y_data: pd.Series
    A pandas Series with true labels.
  • probabilities: pd.Series or np.ndarray
    A pandas Series with predicted probabilities.
  • cutoff: float
    A cutoff value to classify objects.

Exceptions:

  • TypeError:
    Raised if y_data parameter is not a pandas Series.
    Raised if probabilities parameter is not a pandas Series or numpy ndarray.

  • ValueError:
    Raised if the length of y_data and probabilities parameters are not identical.
    Raised if the cutoff parameter is not a positive float from 0 to 1.

Example:

import pandas as pd
from combat.utilities import PredictionResults

# Sample input data
y_data = pd.Series([0, 1, 0, 1, 0])
probabilities = pd.Series([0.2, 0.6, 0.1, 0.7, 0.3])
cutoff = 0.5

# Print prediction results
PredictionResults(y_data, probabilities, cutoff)
print(PredictionResults)