Outliers in property data, remove, keep or report
Flag outliers with the median absolute deviation, investigate each, and remove only before fitting with a reason on record. Never remove from the held-out set.
Updated November 28, 2026
An outlier in property data is a measurement that sits far from where the rest of the data and the model say it should. Detect them with a median-based rule that the outliers themselves cannot distort, investigate each one as a chemistry question, and remove only before fitting, for a reason about the data, with the molecule and the reason written down. Outliers found in residuals after a fit are a modelling decision and must be reported with both sets of figures. Outliers in the held-out set are never removed. Those rules keep the figures honest and keep the dataset's errors from becoming the model's secrets.
A detection rule that does not flinch
The mean and standard deviation are poor outlier detectors because a single large value inflates both and hides itself. Use medians. Take the residuals, compute their median, then compute the absolute deviation of each residual from that median and take the median of those. Multiply by 1.4826, the constant that makes the median absolute deviation match the standard deviation for normal data. A residual more than about 3 scaled units from the median is a candidate outlier.
Suppose eight residuals in log S are 0.1, −0.2, 0.3, −0.1, 0.0, 2.4, 0.2 and −0.3. Sorted they are −0.3, −0.2, −0.1, 0.0, 0.1, 0.2, 0.3, 2.4, and the median is the mean of 0.0 and 0.1, which is 0.05. The absolute deviations from 0.05 are 0.05, 0.25, 0.25, 0.15, 0.05, 2.35, 0.15 and 0.35. Sorted, 0.05, 0.05, 0.15, 0.15, 0.25, 0.25, 0.35, 2.35, with median 0.20, the mean of 0.15 and 0.25. The scaled MAD is 1.4826 × 0.20 = 0.297. The residual 2.4 sits 2.35 / 0.297 = 7.9 scaled units out. The next largest, 0.35 from the median, sits at 1.2. One clear candidate, and the rule found it without the candidate distorting the threshold.
import numpy as np
res = np.array([0.1, -0.2, 0.3, -0.1, 0.0, 2.4, 0.2, -0.3])
med = np.median(res)
mad = 1.4826 * np.median(np.abs(res - med))
score = (res - med) / mad
print(np.round(score, 1), np.where(np.abs(score) > 3)[0])What one point does to the figures
With the 2.4 included, the absolute residuals sum to 0.1 + 0.2 + 0.3 + 0.1 + 0.0 + 2.4 + 0.2 + 0.3 = 3.6 and the MAE is 3.6 / 8 = 0.45. Without it, the sum is 1.2 over 7 molecules and the MAE is 0.17. One molecule in eight carries nearly two thirds of the absolute error. RMSE moves further still, as the guide on MAE versus RMSE shows.
That sensitivity is why the decision cannot be left to taste. A report that says "after removing outliers" without a list and a before-and-after figure has given the reader a number that could have been halved by one deletion.
Investigate before deciding
Every flagged molecule is a question about the data before it is a question about the model. The commonest answers, in rough order of frequency, are these. A unit error, a value in mg/L entered as mol/L, a temperature in Celsius entered as kelvin, or an area in bohr² under a field that says Ų, which the MolBasis findings page records for its own descriptor files and the mfsig guide on units and unit errors describes. A wrong structure, the wrong stereoisomer, a salt entered as the free form, or a tautomer the descriptor code treats differently. A property that is not what the column says, such as a decomposition temperature entered as a melting point, or a hydrate's melting point entered for the anhydrous compound. A genuine measurement of a molecule the model cannot describe, which is information about the applicability domain rather than an error.
Only the first three are reasons to remove or correct a value. The fourth is a reason to keep it and to say what it reveals. The guides on duplicates and conflicting measurements and on units and conversions cover the first two causes in depth, and the guide on crystal packing and polymorphs explains why melting points carry the third kind of surprise.
Before the fit, after the fit, and in the held-out set
Removal before any fit, based on checks of the data alone, is data cleaning. It belongs in the dataset documentation with the molecule identifier and the reason. It does not need a before-and-after figure, because no figure existed yet.
Removal after a fit, based on residuals, is part of the model. It changes which equation the search picks and how good it looks. Report the figures with and without, list the removed molecules, and do not iterate, removing the next worst residual until the figure pleases. A single pass with a stated rule, such as the 3 MAD rule above, is defensible. A sequence of removals is a search over datasets.
Removal from the held-out set is never defensible. The held-out set is the one place where the model meets molecules it did not choose. A data error there should be named next to the figure, with the figure left intact. If the error is certain, give a second figure without it, clearly labelled, and keep the first.
Systematic shifts are not outliers
A unit conversion applied to every molecule, a geometry method that shifts every descriptor by a similar amount, or a solvent model whose energy is offset for the whole set does not produce outliers. It produces a shifted or rescaled dataset that fits perfectly well with wrong coefficients. The MolBasis record's bohr² areas are of that kind. They did not show up as outliers, because every molecule had the same error. Outlier detection finds the molecules that disagree with the rest. It cannot find a mistake the rest all share. That takes a check against an independent value, which is the subject of the reproducibility checklist for QSPR.
Key points
- Detect with the median and the scaled median absolute deviation. A residual beyond about 3 scaled units is a candidate.
- In the example, one residual of 2.4 among eight scores 7.9 scaled units and carries two thirds of the MAE.
- Investigate each candidate as a data question first. Units, structure and property identity explain most of them.
- Remove before fitting with a listed reason, or after fitting with both figures shown. Never remove from the held-out set.
- A shared error across all molecules is not an outlier. Outlier rules cannot find it.
Questions people ask
- How do I detect outliers in a property dataset?
- Compute the median of the residuals and the median of the absolute deviations from that median, scale the latter by 1.4826, and flag any residual more than about 3 of those units from the median. The rule uses medians so that the outliers themselves do not inflate the threshold. Then look at each flagged molecule before deciding anything.
- Is it acceptable to remove outliers from a QSPR training set?
- Yes, when the removal happens before fitting, rests on a reason about the data rather than about the residual, and is listed in the record with the molecule and the reason. Removal after seeing residuals is a modelling choice and must be reported with figures both with and without the removed points.
- Can I remove an outlier from the held-out set?
- No. The held-out set exists to show how the model does on molecules it did not choose. Removing the ones it misses turns the held-out figure into a selected figure. Report the full held-out result, and if a molecule is a clear data error, say so next to the figure rather than deleting it.
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.