Best-in-class calibration quality across a vast number of segments.
Familiar interface. Pass features, not segments.
Fast to train, low inference overhead, even on web-scale data.
Likelihood-improving updates with validation-based early stopping.
Install
pip install mcgrad
from mcgrad import methods
import pandas as pd
import numpy as np
# Prepare your data in a DataFrame
df = pd.DataFrame({
'prediction': np.array([...]), # Base model predictions
'label': np.array([...]), # Ground truth labels
'country': [...], # Categorical features
'content_type': [...], # defining segments
'surface': [...],
})
# Train MCGrad
mcgrad = methods.MCGrad()
mcgrad.fit(
df_train=df,
prediction_column_name='prediction',
label_column_name='label',
categorical_feature_column_names=['country', 'content_type', 'surface']
)
# Get multicalibrated predictions
calibrated_predictions = mcgrad.predict(
df=df,
prediction_column_name='prediction',
categorical_feature_column_names=['country', 'content_type', 'surface']
)
@inproceedings{tax2026mcgrad,
title = {{MCGrad: Multicalibration at Web Scale}},
author = {Tax, Niek and Perini, Lorenzo and Linder, Fridolin and Haimovich, Daniel
and Karamshuk, Dima and Okati, Nastaran and Vojnovic, Milan
and Apostolopoulos, Pavlos Athanasios},
booktitle = {Proceedings of the 32nd ACM SIGKDD Conference on
Knowledge Discovery and Data Mining V.1 (KDD 2026)},
year = {2026},
doi = {10.1145/3770854.3783954}
}