A random forest for USCS soil classes, and the chart it learned
A 2024 paper trains a random forest on 521,316 synthetic soils to predict one of 25 USCS group symbols from seven index properties. We show the same seven inputs give the symbol exactly, and measure which of them matter.
Naming a soil is one of the oldest routines in civil engineering: sieve it, roll it, measure two water contents, and read a two-letter symbol such as SC (clayey sand) or CH (fat clay) off a chart. A 2024 paper in Applied Sciences asks whether a machine-learning model can do the reading, and trains a random forest on 521,316 synthetic soils to predict one of 25 USCS types from seven index properties. It reports an essentially perfect fit. This article uses the soil classification tool, which carries the same decision chart in closed form, to show why that result was almost guaranteed, to confirm that those seven inputs really do pin the symbol down, and to measure which of them do the work. For the laboratory side of the same numbers see the Atterberg limits tool, and for the agronomist’s naming of the same material the soil texture triangle.
The paper in brief
The Unified Soil Classification System (USCS) sorts a soil by two things: how much of it is coarse and how plastic its fines are. Three sieve numbers and two water contents are enough. The paper’s random forest takes seven inputs: the coefficient of uniformity Cu and coefficient of curvature Cc (two shape numbers from the grading curve), the liquid limit LL and plasticity index PI (the water contents at which the soil flows and the range over which it is mouldable), the percentages passing the No. 4 (4.75 mm) and No. 200 (0.075 mm) sieves, and a flag saying whether the soil is organic.
The training set is synthetic: the authors generated soils across the input space (Cc from 0 to 10 in steps of 1, for example) and labelled each with its USCS type, then split 521,316 records 70:30 into 364,921 for training and 156,395 for testing. The reported fit is as good as a fit gets: a variance accounted for of 100, R² of 1, root-mean-square error of 7.96 × 10⁻⁴ and a correlation coefficient of 0.99 on both halves, averaged over 50 runs. The paper then runs eight cases, the first with all seven inputs (its best, scoring 72) and the next seven each dropping one input, to see which inputs matter.
Checked with the tools
The fibub tool does not learn anything: it walks the USCS decision chart (ASTM D2487) step by step and prints the steps. That makes it the right instrument for checking a paper whose labels came from the same chart. Everything below is computed on our own grid of soils, because the paper publishes no input ranges or sample data; the grid is not the paper’s data.
The count of classes matches exactly, and that is the first clue. We built a grid of 5 values of percentage passing 4.75 mm, 7 of percentage passing 0.075 mm, 5 liquid limits, 5 plasticity indices, 5 values of Cu, 5 of Cc and the organic flag, kept only combinations that are physically sensible (fines cannot exceed the finer fraction above them, and PI must stay below the U-line, the practical ceiling for natural soils), and classified every one. That leaves 25,650 soils, falling into exactly 25 distinct group symbols:
CH, CL, CL-ML, GC, GC-GM, GM, GP, GP-GC, GP-GM, GW, GW-GC, GW-GM, MH, ML, OH, OL, SC, SC-SM, SM, SP, SP-SC, SP-SM, SW, SW-SC, SW-SM.
That is the paper’s 25 classes: the fifteen basic symbols minus PT (peat, which is identified by sight and smell, not by index tests), plus the eleven dual symbols the chart awards to borderline soils. So the seven inputs do determine the label, and the label set is exactly 25. A model fed a deterministic rule with no noise and half a million examples has nothing to do but memorise it, which is why R² comes out at 1. That is a sound check of the pipeline rather than a discovery about soils, and it is worth saying so plainly: the real question for such a model is whether it generalises to measured soils, where sieve and limit results carry a per cent or two of laboratory scatter and borderline soils sit on the lines.
Which inputs actually decide the answer. The paper’s Cases 2 to 8 drop one input at a time. We can ask the same question of the rules themselves: for each soil in the grid, move one input across its range and see whether the group symbol changes. The share that changes is how often that input decides the answer (Figure 2):
| Input | Soils whose symbol it changes |
|---|---|
| % passing 0.075 mm (No. 200) | 100.0 % |
| % passing 4.75 mm (No. 4) | 74.1 % |
| Plasticity index PI | 68.5 % |
| Liquid limit LL | 58.3 % |
| Organic flag | 25.9 % |
| Coefficient of curvature Cc | 23.7 % |
| Coefficient of uniformity Cu | 14.8 % |
The ranking is not arbitrary; it is readable straight off the chart. The fines percentage decides the first branch for every soil (50 % splits coarse from fine, then 5 % and 12 % decide whether a coarse soil gets one symbol or two), so it matters always. The No. 4 percentage only chooses between G and S, and only for the 70-odd per cent of our grid that is coarse. Cu and Cc enter just one branch, a coarse soil with less than 12 % fines, which is why dropping them should cost a model least: they are the two inputs a classifier can most afford to lose, and also the two hardest to measure, since they need a grading curve that reaches 10 % passing.
The chart the plasticity inputs feed. LL and PI only act through the plasticity chart, where the A-line (PI = 0.73 (LL − 20)) separates clays from silts and LL = 50 separates lean from fat. Figure 1 draws it with the tool’s own aLine and uLine, with our grid’s LL and PI points on it.
One thing the seven inputs cannot do. The paper lists symbols “from GW to PT”, but PT cannot be reached from Cu, Cc, LL, PI, two sieve percentages and an organic flag, and it never appears in our 25. Nor can the organic groups be decided from a 1/0 flag in the way the standard asks: ASTM D2487 calls a soil organic when its liquid limit after oven drying falls below 75 % of its liquid limit before drying, which is a second measurement, not a label. The tool takes that ratio (its LL after oven drying box) and prints it in the reasoning. A model trained on a flag is therefore learning a slightly different problem from the one a laboratory faces.
| Check | Paper | Soil classification tool |
|---|---|---|
| Number of classes from those seven inputs | 25, coded 1 to 25 | exactly 25 symbols over 25,650 grid soils |
| Are the labels a deterministic function of the inputs? | implied; R² 1, correlation 0.99 | yes, by the ASTM D2487 decision chart, with the steps printed |
| Which input matters most | all seven used in the best case | % passing 0.075 mm, decisive for 100 % of soils |
| Which inputs matter least | not quantified in the readable text | Cu (14.8 %) and Cc (23.7 %), used only below 12 % fines |
| PT (peat) among the classes | listed among the symbols | unreachable from index properties; never appears |
| Organic groups | a 1/0 flag | needs the oven-dry to natural liquid-limit ratio below 0.75 |
How we made the graphs
Both charts and every number above come from scripts/blog-figures/random-forest-uscs-soil-classification-seven-index-inputs.mjs in fibub’s public code. It calls uscs, aashto, aLine and uLine from src/lib/sci/soilclass.ts, the maths behind the soil classification tool.
From the paper: the seven inputs, the 25 classes and the shape of its sensitivity study. Everything numeric is ours: the grid of five to seven values per input, the rule that PI must stay below the U-line, and turning Cu and Cc into D10, D30 and D60 (we fix D60 at 1 mm, set D10 = D60/Cu and D30 = √(Cc·D10·D60), which reproduces any Cu and Cc pair). The organic flag becomes an oven-dry liquid limit of 0.6 × LL when set and 0.95 × LL when not.
How we test the maths
tests/sci.mjs runs tests/sci-tools/soil-classification.mjs on every change to fibub. The classifier is pinned against an independently written Python implementation of the same rules:
- 27 soils, covering every group from GW to CL-ML, must get the same USCS symbol, the same AASHTO group and the same group index as the Python classifier; among them a soil with 59.84 % gravel and 1.19 % fines must be GP and A-2-7, and one with 96.05 % fines, LL 17.69 and PL 8.94 must be CL and A-4 with a group index of 4.
- D10, D30, D60 and the percentage passing any size must match
numpy.interpon log size: D10 = 0.023163877 mm for the test curve. - A hand-worked group index must come out: F = 58, LL = 35, PI = 14 gives 5.745, reported as 6.
- The A-line and U-line must be exact at LL 22, 50 and 58.
- New with this article: the grid above must produce exactly 25 distinct symbols from 25,650 soils, and the worked soil below must be SC with AASHTO A-2-6 and a group index of 1.
Check it yourself
On the soil classification tool:
- Set The grading comes from to typed percentages.
- Type 92 in % passing 4.75 mm (No. 4), 85 in % passing 2 mm (No. 10), 60 in % passing 0.425 mm (No. 40) and 28 in % passing 0.075 mm (No. 200).
- Type 38 in Liquid limit LL (%) and 20 in Plastic limit PL (%). Leave LL after oven drying empty.
- The answer is SC, clayey sand. Under How the USCS symbol was found it prints the four steps: fines 28 % is below 50 % so the soil is coarse-grained; sand (64 %) beats gravel (8 %) so it is a sand; LL 38 with PI 18 is above the A-line at 13.1 so the fines are lean clay; fines above 12 % so the fines name the group.
- The AASHTO panel reads A-2-6 with a group index of 1, and shows the arithmetic: 0.01 × (28 − 15) × (18 − 10) = 1.04.
- Now a borderline soil, to see a dual symbol. Change the sieves to 95 / 90 / 70 / 8, set LL 26 and PL 20, and fill in D10 0.09, D30 0.3 and D60 0.8 (needed because the fines are under 12 %). The answer becomes SW-SC, well-graded sand with clay, with Cu = 8.89 and Cc = 1.25.
- Finally the organic test. Set the sieves to 100 / 98 / 95 / 85, LL 26, PL 20, clear the D-sizes and put 18 in LL after oven drying (%). The answer becomes OL, organic clay or silt with sand, because 18 ÷ 26 = 0.69 is below 0.75.
What researchers can use it for
- Generate labelled training data for exactly this kind of study, with the reasoning attached, instead of hand-coding the chart again: every grid point the tool classifies comes with the branch it took.
- Audit a published classifier’s label set: if a model claims classes the index properties cannot reach, as PT here, that shows up at once.
- Decide which laboratory tests to pay for. If a project’s soils are mostly fine-grained, a grading curve fine enough for Cu and Cc buys almost nothing; if they are clean sands and gravels, it decides the answer.
- Check a borderline call before an argument starts, since the tool prints the A-line value, the dual-symbol rule and the 5 %, 12 % and 50 % thresholds it used.
- Convert between systems for a highway report: the same inputs give the AASHTO group and group index beside the USCS symbol.
- Teach the chart. Steps and thresholds appear with each answer, so a student can see which number moved the result.
The fine print
- The grid, the input ranges and the sensitivity percentages are ours, not the paper’s. The paper’s Table 1 (input ranges) and Table 2 (class codes) are not in the readable text, and its article page is truncated mid-results, so its own per-case scores could not be read.
- Our sensitivity measure asks whether a symbol can change when one input moves. It is a property of the rules, not of any model’s accuracy.
- The tool implements ASTM D2487 and AASHTO M 145 as published decision rules. Different national standards draw the lines in slightly different places.
- A classifier trained on exact labels says nothing about measurement error. Real sieve and limit results scatter, and soils that sit on a line will flip either way; that, not the fit, is where such a model should be tested.
- Nothing here evaluates the paper’s random forest itself, its hyperparameters or its reported error statistics. We note only that its target is a deterministic function of its inputs, which a near-perfect fit should be read against.
Sources
- Liu, C.-Y., Ku, C.-Y., Wu, T.-Y. and Ku, Y.-C. (2024), An Advanced Soil Classification Method Employing the Random Forest Technique in Machine Learning, Applied Sciences 14(16): 7202, doi:10.3390/app14167202. Licence CC BY 4.0, taken from the Crossref record (the MDPI page's rights metadata says CC BY 3.0), checked 2026-11-24; the Crossref record carries no correction or retraction. Values used here: seven inputs (coefficient of curvature Cc, coefficient of uniformity Cu, plasticity index, an organic flag coded 1 or 0, liquid limit, percentage passing the No. 4 sieve and percentage passing the No. 200 sieve); Cc sampled from 0 to 10 in steps of 1; labels from the Unified Soil Classification System with 25 soil types coded 1 to 25 and fifteen two-letter symbols listed from GW to PT; a synthetic data set of 521,316 records split 364,921 for training and 156,395 for testing; reported VAF 100, R² 1, RMSE 7.96 × 10⁻⁴, MAE 6.48 × 10⁻⁶ and a correlation coefficient of 0.99 for training and testing, averaged over 50 runs; eight cases, Case 1 using all seven inputs with the maximum total score of 72 and Cases 2 to 8 each dropping one input; the model described as a regression with a mean-squared-error splitting criterion.
- ASTM D2487 Unified Soil Classification System and AASHTO M 145 (the decision rules and the group index formula, as implemented in fibub's own code); Casagrande's A-line and the U-line.
If you are an author or publisher and want a credit or a passage changed or removed, tell us and we will act quickly.