MolBasis
overfittingmodel-searchpermutation-testqspr5 min read

Overfitting with few parameters, because the search is the model

Two coefficients can still overfit when the descriptor, the exponent and the term count were chosen by scoring hundreds of candidates on the same molecules.

Updated November 28, 2026

A model with two fitted coefficients can still overfit, because the coefficients are not the only things the data chose. The descriptor, its exponent and whether a second term exists were all picked by scoring hundreds of candidates on the same molecules. The effective number of parameters is set by the size of the search, not by the length of the equation. This guide counts the choices, shows what the best of many null candidates looks like, and lists the signs that a search has overfitted.

Counting what the data decided

Write a one-term kernel as ŷ = β₀ + β₁·z(f^p). Two coefficients appear. Now count the decisions behind them. Which of nine descriptors is f. Which of about twenty grid values is p. Whether a second term is added, and if so which of 36 descriptor pairs and 400 exponent pairs. Each decision was made by fitting the candidate and keeping the one with the best score on the training molecules.

That is a search over roughly 180 one-term and 14,400 two-term candidates, with the exact counts depending on the grid. Every candidate is a small least-squares fit, so every candidate has some chance of scoring well by accident. The winner is the candidate that was luckiest as well as the one that was best. The two cannot be separated from the training score alone.

A model's capacity to fit noise is not the number of coefficients in its final form. It is the number of distinct functions it could have returned. For a searched kernel that number is in the thousands.

The best of many null candidates is not zero

Under the null hypothesis of no relation, the Pearson r between a random column and the property has a standard deviation of about 1/√(n − 1). For n = 30 molecules that is 0.19. A single random descriptor would therefore show r near zero with a spread of 0.19, and a reader would dismiss it.

The search does not look at a single random descriptor. It looks at 180 and keeps the largest absolute value. The expected maximum of many independent draws grows with the square root of twice the logarithm of their number, so for a few hundred draws the winner sits roughly two and a half to three standard deviations out. With a spread of 0.19 that places the best null candidate near r = 0.5. A score that would have been a finding from one descriptor is the expected outcome of a blind search.

The following simulation runs the experiment. Run it several times and watch the best null score.

import numpy as np
rng = np.random.default_rng(0)
n, K = 30, 180
y = rng.standard_normal(n)
best = 0.0
for _ in range(K):
    x = rng.standard_normal(n)
    best = max(best, abs(np.corrcoef(x, y)[0, 1]))
print(round(best, 2))

Correlated candidates, such as neighbouring exponents of the same descriptor, are not independent, so the real count of distinct chances is lower than 180. It is still far above one.

The permutation floor measures the search, not the equation

The remedy is to calibrate against the search itself. Shuffle the property values so that no molecule keeps its own, rerun the entire search including the exponent grid and the choice of term count, and record the best score. Repeat many times. The distribution of those best scores is the noise floor of the procedure.

In the MolBasis record the winning equation must sit at least 0.30 in r above the 95th percentile of that floor. The guide on permutation tests and y-scrambling explains the test and the Rücker variants. The point for this guide is that the floor is a property of the search. A larger grid, more descriptors or a second term each raise the floor, and the equation must clear a higher bar.

The 30 % MAE lift required by the gate plays a similar role. It asks the equation to beat the training-mean baseline by a margin on the held-out molecules, which a lucky null candidate rarely does once the molecules are new.

What few parameters do protect against

Few coefficients are not worthless. Given a chosen form, two coefficients cannot bend to individual molecules. The fitted line is stable within the range of the training data. A power-law term extrapolates monotonically rather than flat or wildly. And a wrong equation fails in a visible way, with a slope or a sign that a chemist can question.

What few coefficients do not protect against is the choice of form. That protection has to come from how the form was chosen. Choose it on one set of molecules and report on another. Choose it inside each fold of a nested cross-validation. Or calibrate the search with permutations. The guide on feature selection by search gives the arithmetic of the optimism these methods remove.

Signs that a search has overfitted

Several symptoms show up on a kernel page or in a research record.

  • The held-out r sits far below the in-sample r. Some gap is normal. A large gap means the training score was mostly selection.
  • The calibration slope on held-out molecules is well below 1. Predictions are compressed toward the mean, which is what a weak relation stretched by selection looks like. The guide on the calibration slope shows how to read it.
  • The held-out set is small. With a 25 % share of scaffolds rather than of molecules, a held-out set can be a few dozen molecules, and its figures move with every molecule. The guide on small test sets and unstable figures sets the scale.
  • The plateau is wide. If many equations tie with the winner, the data did not pick the winner. The search did.

MolBasis kernel pages lead with the held-out result for this reason. The in-sample figure appears second, and the methodology page explains the gate that every published equation passed.

Key points

  • A searched one-term equation reflects thousands of candidate functions. Its two coefficients understate what the data chose.
  • With 30 molecules and 180 null candidates, the best candidate reaches r near 0.5 by chance alone.
  • The permutation floor calibrates the search, and in the MolBasis record the winner must clear it by 0.30 in r.
  • Few coefficients make the fitted line stable and its failures visible. They do nothing about the optimism of choosing the form.

Questions people ask

Can a model with two coefficients overfit?
Yes. The coefficients are only part of what the data decided. If the descriptor, its exponent and the number of terms were chosen by scoring many candidates, the winning score is biased upward even when no real relation exists.
What is the effective number of parameters of a searched equation?
There is no exact count, but it grows with the logarithm of the number of candidates tried. A one-term equation picked from 180 candidates behaves more like a model with several free parameters than like one with two.
How does a permutation test detect search overfitting?
Shuffle the property values, rerun the whole search and record the best score. Repeat many times. The 95th percentile of those scores is the noise floor, and a real result must clear it by a margin.

Further reading

In practice: A kernel on this site is one or two descriptor terms with coefficients from a single ridge solve. The methodology page gives the exact form, the grid and the gate the search had to pass.

See the kernels themselves

Every kernel is shown with its held-out result, the number of molecules it rests on and what it cannot be trusted for.