Permutation tests and y-scrambling, the noise floor of a search
Shuffle the property values, rerun the whole search, record the best score, repeat. The 95th percentile of those scores is the floor a real result must clear.
Updated November 28, 2026
A permutation test shuffles the property values among the molecules, destroying any real relation, and then runs the same model search that produced the real result. The best score found on scrambled data shows how far chance alone can climb through that search. Repeating the shuffle a few hundred times gives a distribution, and its 95th percentile is the noise floor. The MolBasis rigor gate asks that a kernel's r sit at least 0.30 above that floor. A winner that barely clears it is indistinguishable from a lucky search.
Why a short equation needs a noise floor at all
A two-coefficient equation looks too simple to overfit. The search that chose it is not simple. With nine descriptors, an exponent grid and two-term combinations, several thousand candidate equations compete, and the winner is the one whose score was highest on a small dataset. Some of that height is real signal. Some is noise that happened to align. The guide on feature selection by search explains the mechanism. The permutation test measures the second part directly, by removing the signal and seeing what remains.
The result depends strongly on the dataset size. For n molecules, the correlation between a random descriptor and a random target has a standard deviation of about 1 / √(n−1). On 12 molecules that is 0.30. The maximum over thousands of correlated candidates reaches well above that. Small datasets with a large search can produce r above 0.8 on scrambled values, and the only way to know is to run the test.
Scrambling the right thing
Rücker and co-workers reviewed y-randomisation in 2007 and distinguished variants. The one that matters for a searched model reruns the full search on each scrambled target. The cheaper variant, which keeps the chosen descriptors and refits only the coefficients, measures the chance level of a fixed two-coefficient model. That level is low and the test is then too easy. It will declare almost any searched equation significant.
The scrambling must also respect the structure of the real fit. If the real search used grouped cross-validation by molecule, the scrambled search must use the same groups. If duplicates were averaged before fitting, scramble after averaging. Shuffle the targets among molecules, not among rows, or duplicates will carry their shared value and leak as they did before.
A worked run with 200 permutations
Suppose the real search on a given dataset returns a best held-out r of 0.74. Run 200 scrambles, rerunning the search each time, and collect the 200 best scores. Suppose they range from 0.31 to 0.69, with a 95th percentile of 0.58 and three values at 0.69, 0.71 and 0.74.
The p-value is the number of permutation scores at or above 0.74, plus one, over 201. One scramble tied the real score, so p = 2 / 201 = 0.0100. The margin over the floor is 0.74 − 0.58 = 0.16. Under the MolBasis gate, which requires a margin of at least 0.30 in r above the 95th percentile of noise, this equation would fail. A p-value near 0.01 and a failed gate are not a contradiction. The gate asks for a result that is far above chance, not one that is merely unlikely to be chance.
import numpy as np
from sklearn.model_selection import GroupKFold, GridSearchCV, permutation_test_score
from sklearn.linear_model import Ridge
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
cv = GroupKFold(n_splits=5)
search = GridSearchCV(make_pipeline(StandardScaler(), Ridge()),
{"ridge__alpha": [1e-3, 1e-2, 1e-1, 1.0]}, cv=cv)
rng = np.random.default_rng(2026)
floor = []
for _ in range(200):
y_perm = y.copy()
rng.shuffle(y_perm) # shuffle targets among molecules
search.fit(X, y_perm, groups=groups)
floor.append(search.best_score_) # best score the search found on noise
floor = np.array(floor)
search.fit(X, y, groups=groups)
real = search.best_score_
p = (np.sum(floor >= real) + 1) / (len(floor) + 1)
print(real, np.percentile(floor, 95), p)The scikit-learn function permutation_test_score does the same for a fixed estimator. Wrapping the search object as the estimator makes it rerun the selection on each permutation, which is what the test needs. The loop above makes that explicit.
Reading the floor next to the other checks
The permutation floor answers one question, whether the winner beats what chance could find. It does not say how the winner performs on new molecules. A searched equation can clear the floor and still fail on a scaffold-blind split. The checks complement each other. Nested cross-validation removes the optimism of the selection score. The held-out split measures prediction. The floor confirms that the search had something to find.
The MolBasis methodology runs all three. The record's permutation floor requires the winner to sit at least 0.30 r above the 95th percentile of noise, and kernels that pass the whole gate are labelled as recorded. The guides do not quote any kernel's margin, because the result files are not available for review and the figures are reported from the record.
When a floor was never run
A high reported r on a small dataset, found by a large search, with no permutation test, is a figure of unknown meaning. The findings page records a related failure mode in the MolBasis record itself. A descriptor defect produced an inflated melting-point figure, and the inflation was caught because other checks disagreed with the headline number. The guide on how a descriptor defect inflated a correlation tells that story. A noise floor is one of the checks that makes such a disagreement visible.
Key points
- Shuffle targets among molecules, rerun the whole search, and record the best score. Repeat a few hundred times.
- The 95th percentile of those scores is the floor. Refitting only the chosen equation on scrambled data sets the floor too low.
- p-value equals permutations at or above the real score, plus one, over permutations plus one.
- The MolBasis gate asks for a margin of at least 0.30 in r above the floor, which is a stronger demand than a small p-value.
- Clearing the floor shows the search found signal. It does not replace a held-out split.
Questions people ask
- What is y-scrambling in QSPR?
- It is a permutation test in which the property values are shuffled among the molecules so that no real relation remains, and the model is refitted. The scores obtained on scrambled data show how high chance alone can reach. A real model has to score well above that level to mean anything.
- Why must the whole search be rerun on scrambled data, not just the final equation?
- Refitting only the chosen descriptors on scrambled values measures the chance level of a two-coefficient fit, which is low. The real model was chosen from thousands of candidates, and chance acting through that search reaches much higher. Only rerunning the search gives the floor the real winner was actually competing against.
- How do I turn permutation scores into a p-value?
- Count the permutations whose best score reached or exceeded the real score, add one, and divide by the number of permutations plus one. With 200 permutations and 3 at or above the real score the p-value is 4 divided by 201, about 0.02. A margin above the 95th percentile is a more informative summary than the p-value alone.
Further reading
In practice: The methodology page describes the checks applied to every kernel, scaffold-blind split included, and the limits of those checks. Every kernel page quotes the held-out figure first and the in-sample figure second.
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.