Skip to content

PredictionCalibration

PredictionCalibration

The function predicts the probability based on the calibration model.

Parameters:

  • x_data: pd.DataFrame
    A series of predictions of the raw models.
  • model: LogisticRegression
    A Logistic Regression Model for calibration.
  • logprob: bool
    A boolean variable whether to calculate a logarithm of probabilities.

Returns:

  • pred: np.ndarray
    A NumPy array of the calibrated probabilities.

Exceptions:

  • TypeError:
    Raised if x_data parameter is not a pandas DataFrame object.
    Raised if logprob parameter is not logical.

Example:

import pandas as pd
from sklearn.linear_model import LogisticRegression
from combat.calibration import PredictionCalibration, CalibrationModel

# Sample input data
x_data = pd.DataFrame({'A': [1, 2, 3, 4, 5], 'B': [6, 7, 8, 9, 10]})
model = CalibrationModel(*args)
logprob = False

# Predict calibrated probabilities
pred = PredictionCalibration(x_data, model, logprob)
print(pred)