Machine Learning applied to soil compaction.
In this article, we will use Machine Learning techniques to optimize soil compaction. Soil is a material composed of a solid, liquid and gaseous part, which was formed over hundreds of millions of years...
A learning project shared by the community. The article documents its team, methods and results; it does not establish that the prototype is ready for real-world use.

This archive includes automatic translations. Audio, video and text inside images remain in their original language.
In this article, we will use Machine Learning techniques to optimize soil compaction.
Soil is a material composed of a solid, liquid and gaseous part, which was formed during hundreds of millions of years of weathering and sedimentation. We understand compaction to eliminate the greatest amount of gaseous mass (commonly air) from the soil by loading.
The compaction curve consists of a curve that is constructed after marking the pairs of dry-density and moisture values of the sample. With a minimum of 5 points, a curve is drawn by hand that can correlate all these points and the maximum dry density and the optimal humidity at which this soil can be compacted are obtained.

These parameters are linearly independent and there is no relationship between the compaction test and soil classification, so two different tests are carried out to obtain it.
Problem description
For each kilometer of road, 5 test pits are required, of which two tests must be submitted:
- Soil classification
- Compaction
In practice, due to the economic resources and logistics involved, only 5 classification tests and 2 compaction tests are carried out and the results are interpolated.

Objective
Determine using Machine Learning techniques a correlation between soil classification and soil compaction, referring to the maximum dry density and optimal humidity value, to calculate the humidity at which a certain section of road will be compacted.
Model selection
Because the result is known and the problem is numerical, the models used were:
- Linear regression
- Multi-linear regression
- Polynomial regression
Techniques implemented
Dimension reduction
All columns that do not provide relevant information were reduced: 'Well', 'Side', 'Prf o (m)', 'Prf f (m)', '% Hum', 'ST >3', '3', 'AASTHO', '#', 'SUCS', '100%', '97%', '95%', '100%.1', '97%.1', '95%.1'
Missing values
In the LL column it was found that 30 data were missing, a histogram was used and it was determined that the normal curve that describes its data was offset from the middle, so the missing data was filled in with the median, which is 32.2

Graphics
All the necessary graphs were made to understand and interpret the problem.
Linear relationship (with sklearn)

2nd degree polynomial relationship (with numpy)

3rd degree polynomial relationship (with numpy)

Multi-linear relationship (with sklearn)

Multi-linear relationship (with sns) where the 14 parameters are related to each other and their relationship with the optimal Humidity.


![]()
Model evaluation
D max vs H opt
Linear regression:

2nd degree polynomial regression:

3rd degree polynomial regression:

Feature vs H opt
Linear regression:

Analysis of results
D max vs H opt
It can be seen that it is the polynomial regression that has a correlation coefficient closest to 1 and in the graph the one that best fits, which is why it will be the regression adopted
Feature vs H opt
A correlation coefficient value close to 1 can be observed and in the sns graphs the vast majority are linear relationships, so the multi-linear model achieved is accepted.
Conclusion
A correlation was determined between soil classification and soil compaction, to calculate the humidity at which a certain stretch of road will be compacted:

H opt = 0.117*(LL) + 0.0212*(LP) — 0.007*(2) + 0.010*(1 ½) — 0.004*(1) — 0.001*(¾) + 0.017*(⅜) — 0.001*(no 4) — 0.052*(no 10) +
+ 0.054*(no 40) + 0.036*(no 200) — 0.043*(% Grava) + 0.007*(% Arena) + 0.036*(% Finos) + 3.779

D max = 4.110*10^(-4)*(H opt)² — 4.256*10^(-2)*(H opt) + 2.394
WRITTEN BY
Mauricio Ramirez Salamanca
Follow
More artificial intelligence!
The mission of Saturdays.ai is to make artificial intelligence more accessible (#ai4all) through intensive courses and programs where projects for good are carried out (#ai4good).
Explore our AI master’s programme at https://saturdays.ai/master-ia-online/
If you want to learn more about artificial intelligence join our community at community.saturdays.ai or visit us on our website www.saturdays.ai Join us!
A history of the Saturdays.AI community. Originally published on Nov 12, 2021.
← More community stories



