Views
No views yet
scikit-learn RandomForestRegressor that predicts concrete compressive
strength (MPa) from mix proportions and curing age. Trained on the public
UCI Concrete Compressive Strength dataset.Status: honest baseline. This is a reproducible model on a well-known public benchmark — not a proprietary or state-of-the-art model. It is useful as a fast strength estimate and as a transparent baseline; it is not a substitute for laboratory testing or code-compliance verification.
train_test_split(test_size=0.2, random_state=42).app/backend/ml_models/data/concrete_uci.csv.| Metric | Value |
|---|---|
| R² | 0.8795 |
| RMSE | 5.573 MPa |
| MAE | 3.906 MPa |
python scripts/reproduce_metrics.py in the source repo (retrains and asserts a
match against the committed metrics).scaler.skops (a StandardScaler fit on the training set):cement (kg/m³)blast_furnace_slag (kg/m³)fly_ash (kg/m³)water (kg/m³)superplasticizer (kg/m³)coarse_aggregate (kg/m³)fine_aggregate (kg/m³)age (days)_sklearn_version). Loading with a different scikit-learn raises
InconsistentVersionWarning and can change predictions — pin these exact
versions for guaranteed-consistent output:scikit-learn==1.9.0
skops==0.14.0
numpy==2.4.6pip install -r requirements.txt # bundled in this repo1import numpy as np
2from skops.io import load, get_untrusted_types
3
4f = "model.skops"
5model = load(f, trusted=get_untrusted_types(file=f))
6scaler = load("scaler.skops", trusted=get_untrusted_types(file="scaler.skops"))
7
8# cement, slag, fly_ash, water, SP, coarse, fine, age
9x = np.array([[380, 0, 0, 175, 6, 1000, 780, 28]], dtype=float)
10strength_mpa = float(model.predict(scaler.transform(x))[0])
11print(round(strength_mpa, 1), "MPa")