Challenge - 5 Problems
Probability Calibration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
What does probability calibration mean in machine learning?
Imagine you have a model that predicts the chance of rain tomorrow. What does it mean if the model is well calibrated?
Attempts:
2 left
💡 Hint
Think about how predicted chances relate to what really happens over time.
✗ Incorrect
Probability calibration means that when the model says 70% chance, it actually rains about 70% of those times. This matches predicted probabilities to real outcomes.
❓ Predict Output
intermediate2:00remaining
Output of calibration curve code snippet
What output does this code produce?
ML Python
from sklearn.calibration import calibration_curve import numpy as np # True labels y_true = np.array([0, 0, 1, 1, 1, 0, 1, 0, 1, 0]) # Predicted probabilities y_prob = np.array([0.1, 0.4, 0.35, 0.8, 0.9, 0.2, 0.7, 0.3, 0.85, 0.05]) prob_true, prob_pred = calibration_curve(y_true, y_prob, n_bins=3) print(np.round(prob_true, 2))
Attempts:
2 left
💡 Hint
Check how the predicted probabilities are grouped into bins and how many true positives are in each bin.
✗ Incorrect
The calibration_curve function (default strategy='uniform') groups predictions into equal-width bins and computes the fraction of positives in each non-empty bin. Here, the fractions are 0.0 (low bin), 0.5 (mid bin), and 1.0 (high bin).
❓ Model Choice
advanced2:00remaining
Best calibration method for a binary classifier with overconfident predictions
You have a binary classifier whose predicted probabilities are often too close to 0 or 1, making it overconfident. Which calibration method is most suitable to fix this?
Attempts:
2 left
💡 Hint
Consider which method can handle non-linear calibration well.
✗ Incorrect
Isotonic Regression is a flexible, non-parametric method that can correct overconfident predictions by fitting a monotonic function, often better than Platt Scaling for such cases.
❓ Metrics
advanced1:30remaining
Which metric directly measures calibration quality?
Among these metrics, which one directly measures how well predicted probabilities match observed outcomes?
Attempts:
2 left
💡 Hint
Think about a metric that compares predicted probabilities to actual binary outcomes.
✗ Incorrect
The Brier Score measures the mean squared difference between predicted probabilities and actual outcomes, directly assessing calibration quality.
🔧 Debug
expert2:30remaining
Why does this calibration code raise an error?
What error does this code raise and why?
ML Python
from sklearn.calibration import CalibratedClassifierCV from sklearn.linear_model import LogisticRegression import numpy as np X = np.array([[1, 2], [3, 4], [5, 6], [7, 8]]) y = np.array([0, 1, 0, 1]) model = LogisticRegression() calibrated = CalibratedClassifierCV(model, method='sigmoid') calibrated.fit(X, y) # Predict probabilities probs = calibrated.predict_proba(X)
Attempts:
2 left
💡 Hint
Check the standard usage of CalibratedClassifierCV with an unfitted base estimator.
✗ Incorrect
No error occurs. CalibratedClassifierCV clones the unfitted base estimator internally and fits copies of it on cross-validation folds during its own fit method.