Concepts / Overfitting and Model Complexity

Overfitting and Model Complexity

The second question is how often the model is actually correct when it says that.

  • Programming

Why Certainty Is Not Enough

Imagine a classifier that reports it is very certain about a prediction. It is tempting to conclude that the prediction is probably right, and that the more certain the model sounds, the more trustworthy it is. This reasoning feels sensible, but it quietly mixes two separate questions. The first question is what the model says about its own confidence. The second question is how often the model is actually correct when it says that. This article is about the gap between those two questions and about the property that closes that gap.

The source ties the reliability of a model's uncertainty to its complexity, and it makes two claims that point in opposite directions. First, a model that is more overfitted tends to make more certain predictions, even when those predictions are wrong. Second, a model with less complexity usually has more uncertainty in its predictions. Both claims matter, and by the end of this article you should be able to explain why each one matters for calibration.

Two Questions Hidden in One Belief

When a model reports a confidence, that report is a statement about itself. The question of whether the report can be trusted is a different one. Trust depends on what happens across many predictions, not on how a single prediction sounds. The source makes this concrete by describing the property that connects stated confidence to outcomes.

Definition

A model is calibrated when its reported uncertainty matches how correct it is: a prediction made with 70% certainty should be correct about 70% of the time across such predictions.

Rule

Read the formula in words: among all the predictions where the model reports confidence $p$, the fraction that turn out correct should be $p$. Notice that the claim is about a group of predictions that share the same stated confidence. One prediction made at 70% confidence can be right or wrong, and calibration says nothing about that single outcome. Calibration describes what happens across many predictions made at that confidence level.

Stated confidence70%Stated confidence70%Observed correct rateabout 70%Observed correct ratebelow 70%
When a model states 70% confidence, how does the rate of correct predictions compare to that stated value for a calibrated model and for an overconfident one?
Worked example

Checking whether a confidence level is calibrated

A model makes 10 predictions and reports 70% confidence for each one. Seven of the 10 predictions are correct. Is the model calibrated at this confidence level?

  1. 1
    Identify the stated confidence

    The group of predictions shares one stated confidence, 70%, so the target correct rate is 0.70.

  2. 2
    Compute the observed correct rate

    Seven correct out of 10 predictions gives an observed correct rate of 7/10, which is 0.70.

  3. 3
    Compare the two values

    The stated confidence and the observed rate match, so at this confidence level the model is calibrated on this group.

Result

The model is calibrated for this group. If only 4 of the 10 were correct, the observed rate of 0.40 would not match the stated 0.70, and the model would not be calibrated at this level.

Reading Probabilities in Binary Problems

Classifiers that expose uncertainty estimates give a probability for each class. In a binary problem with two classes, those two probabilities add up to 1. Because they must sum to 1, exactly one of the classes will be above 50% certainty, and that is the class the model predicts. The predicted class is therefore the one carrying the larger share of the probability.

Worked example

Identifying the predicted class from two probabilities

A binary classifier returns the following probabilities for three new inputs, listed as (class 0, class 1): input A is (0.82, 0.18), input B is (0.45, 0.55), and input C is (0.30, 0.70). Which class is predicted for each input?

  1. 1
    Check that each pair sums to 1

    For input A, 0.82 plus 0.18 equals 1. For input B, 0.45 plus 0.55 equals 1. For input C, 0.30 plus 0.70 equals 1.

  2. 2
    Find the class above 50%

    Input A has class 0 above 50%, input B has class 1 above 50%, and input C has class 1 above 50%.

  3. 3
    Name the predicted class

    The predicted class is the one above 50%: class 0 for input A, class 1 for input B, and class 1 for input C.

Result

Input A is predicted as class 0, and inputs B and C are predicted as class 1. Input B is a close call because its class 1 value is only 0.55, which shows that a predicted class can still carry modest certainty.

Class 00.30Class 10.70 predictedsum to 1
For a single input in a binary problem, which class does the model predict, and how do the two values relate?

Probabilities Across Three or More Classes

Everything so far has concerned binary classification. The source notes that the decision_function and predict_proba methods also work in the multiclass setting, where there are more than two classes. The source illustrates this on the Iris dataset, which is a three-class classification dataset. Both methods provide uncertainty estimates in binary and multiclass settings, but they report those estimates in different forms.

The key point for reading multiclass output is that the per-class values are the model's reported uncertainty about each class. The binary rule that the two probabilities sum to 1 is the special case of two classes. When you move to three classes, you read each class's value in the same spirit, and the predicted class is the one the model assigns the largest share of its uncertainty.

How Complexity Shapes Certainty

The source ties the reliability of a model's uncertainty to its complexity. An overfitted model tends to make more certain predictions, and that certainty can be wrong. The reason is that an overfitted model can look confident for the wrong reason. Its high certainty reflects how closely it has fit the training data, not necessarily how often it will be right on new inputs. So certainty alone cannot be read as calibration.

The opposite pattern appears on the other side. A model with less complexity usually shows more uncertainty in its predictions. The source also shows a gradient boosting model, where the decision boundary is drawn next to the predicted probabilities for class 1 over the same dataset. The boundaries in that visualization are much more well-defined, and the small regions where the model is uncertain are clearly visible. Those narrow uncertain bands sit where the probability for class 1 is near the middle, close to the boundary between the two classes.

Less complexitymore uncertainty inpredictionsMore complexitycloser fit to training dataWider uncertain bandsnear the class boundaryMore certainpredictionsmay still be wrong
As model complexity rises, how does prediction certainty change, and why do overfitted and simpler models sit at opposite ends?

Where the Belief Diverges

The belief that certainty signals reliability goes wrong at one specific step. The flowchart below follows the reasoning. A model reports high certainty, and the belief adds that the prediction is probably right. The check that calibration requires is to ask how often predictions made at that stated confidence are actually correct. If that rate matches the stated confidence, the report is calibrated. If it does not, the belief has separated from what calibration requires.

Model reports highcertaintyAssume the predictionis probably rightthe belief being testedIs the correct rateat this confidenceclose to the statedvalue?calibration checkCalibrated at thislevelBelief diverges fromcalibrationcertainty was not evidenceyesno
At which step in reasoning about a model's confidence does a belief stop matching what calibration requires?
  • Common mistake

    Treating a high stated confidence as proof that the prediction is correct

    What it looks like

    A model reports 95% certainty on a new input, and the learner concludes the answer is settled.

    Why it fails

    Calibration is a property of groups of predictions that share a stated confidence, not of one prediction's certainty. Certainty alone does not establish reliability.

    Do this instead

    Ask how often predictions made at that confidence level are actually correct across many cases.

  • Common mistake

    Assuming an overfitted model is trustworthy because it sounds confident

    What it looks like

    A model fits its training data very closely and then reports very high certainty on fresh inputs.

    Why it fails

    An overfitted model tends to make more certain predictions even when they are wrong, so its confidence reflects closeness to training data rather than accuracy on new inputs.

    Do this instead

    Check observed correctness on held-out inputs before accepting the reported certainty.

  • Common mistake

    Assuming that a method which returns probabilities is calibrated

    What it looks like

    A learner calls predict_proba and treats every returned value as a calibrated probability.

    Why it fails

    Providing an uncertainty estimate does not by itself guarantee calibration, and the source does not claim calibration for either method.

  • Common mistake

    Reading a single predicted class as meaning the model is sure

    What it looks like

    For an input with probabilities 0.45 and 0.55, the learner treats class 1 as a confident answer.

    Why it fails

    The predicted class is simply the one with the larger share, and a narrow margin means the model is only modestly certain.

Practice Reading Probabilities

EASY

A binary classifier returns (class 0, class 1) = (0.64, 0.36) for one input and (0.20, 0.80) for another. For each input, state the predicted class and say whether the model's reported confidence for that input is above 70%. Then explain why being above 70% for one input does not by itself show the model is calibrated.

Hints
  • Remember that the two probabilities for one input sum to 1, so the predicted class is the one above 50%.
  • Calibration is about many predictions made at the same stated confidence, not about one prediction.

Key Takeaways

  • A model is calibrated when a prediction made with stated confidence p is correct about p of the time across predictions that share that confidence.
  • In binary classification the two class probabilities sum to 1, so exactly one class is above 50% and is the predicted class.
  • Overfitted models tend to make more certain predictions even when they are wrong, while less complex models usually show more uncertainty, so certainty alone is not evidence of calibration.
  • The methods decision_function and predict_proba provide uncertainty estimates for binary and multiclass problems, but providing an estimate does not guarantee calibration.

Related concepts

More concepts starting with O