Chapter 6 · Section 6.10 · Capstone Case Study

CE Case Study: Concrete Strength Prediction

An end-to-end neural network workflow that predicts 28-day compressive strength from mix design — tying together every concept in Chapter 6.

~30 min read 1030-sample UCI dataset R² ~ 0.92 Final sub-chapter

The Problem: From Mix Sheet to Strength

A concrete batch plant ships hundreds of cubic metres per day. The single number that matters most for structural acceptance is the 28-day characteristic compressive strength, fck, in megapascals (MPa). Today, every batch is sampled, cubes are cast, cured for 28 days, and crushed in a compression machine. By the time the number lands on the engineer's desk, the concrete in question has been sitting in a column for four weeks.

Could we predict that strength at the moment the truck leaves the plant, from the mix sheet alone? Empirical formulas like Abrams' law, Bolomey, and the curves in ACI 211 give a first estimate — but they were calibrated on narrow ranges and ignore the nonlinear interactions between supplementary cementitious materials (slag, fly ash) and admixtures (superplasticisers).

A neural network, trained on the famous I-Cheng Yeh concrete dataset (UCI, 1030 samples, 8 features), captures those interactions and routinely beats the empirical models by 30–40% on RMSE. This sub-chapter walks through the full workflow, end to end.

Inputs & Output

Inputs (8 features per mix):

  • Cement (kg/m³) — OPC content
  • Blast furnace slag (kg/m³) — GGBFS replacement
  • Fly ash (kg/m³) — Class F/C SCM
  • Water (kg/m³) — mix water
  • Superplasticiser (kg/m³) — HRWR admixture
  • Coarse aggregate (kg/m³) — 10–20 mm
  • Fine aggregate (kg/m³) — sand
  • Age (days) — time since casting

Output: compressive strength fc in MPa (regression target).

Why a Neural Network?

Empirical formulas treat each ingredient mostly in isolation: Abrams' law is essentially fc = A / Bw/c. But in real life, the effect of fly ash depends on water content; the effect of superplasticiser depends on cement fineness; and age is nonlinear (rapid early gain, asymptotic later). An MLP with two hidden layers and ReLU activations can learn arbitrary nonlinear functions of all 8 variables jointly — exactly the structure we built up through Sections 6.1–6.9.

The Full ML Workflow

Below is the ten-step recipe we will follow. Every step exercises a concept introduced earlier in Chapter 6.

Ten Steps from Data to Deployment

  1. Load & explore data — 1030 rows, 8 features, 1 target. Build a correlation heatmap.
  2. Preprocess — z-score normalise inputs, split 70/15/15 into train/val/test.
  3. Choose architecture — MLP: 8 → 64 → 32 → 1, ReLU activations.
  4. Choose loss — mean squared error for regression.
  5. Choose optimiser — Adam, learning rate 1×10−3.
  6. Regularise — dropout 0.2 between hidden layers, early stopping (patience 20).
  7. Train — batch size 32, up to 500 epochs, monitor val loss every epoch.
  8. Evaluate — RMSE, MAE, R² on held-out test set.
  9. Interpret — permutation feature importance to validate against CE intuition.
  10. Deploy — web tool, mobile QC app, plug-in to design software.

Concept Map — Where Each Idea Lives

  • Steps 3–4 use perceptrons, MLPs, ReLU, MSE (6.1–6.4).
  • Steps 5, 7 use gradient descent, backprop, mini-batches, epochs (6.5–6.7).
  • Step 6 uses dropout, early stopping (6.8).
  • Step 7 uses GPU/framework acceleration (6.9).
  • Step 10 ties back to real CE deployment constraints.

Step 1–2: Data & Preprocessing

The Yeh dataset spans cement contents from 102 to 540 kg/m³, water/cement ratios from 0.30 to 0.90, ages from 1 to 365 days, and strengths from 2.3 to 82.6 MPa. It covers ordinary, high-strength, and SCM-blended mixes — broad enough to be useful, narrow enough that we should still respect its boundaries (more on extrapolation later).

load_and_split.py PyTorch
import pandas as pd
import numpy as np
import torch
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler

df = pd.read_csv("concrete.csv")     # 1030 rows, 9 columns
X = df.iloc[:, :8].values            # 8 features
y = df.iloc[:, 8].values.reshape(-1, 1)   # strength in MPa

# 70 / 15 / 15 split
X_tr, X_tmp, y_tr, y_tmp = train_test_split(X, y, test_size=0.30, random_state=42)
X_val, X_te, y_val, y_te = train_test_split(X_tmp, y_tmp, test_size=0.50, random_state=42)

# z-score normalisation: fit on TRAIN ONLY, then transform val/test
sx, sy = StandardScaler(), StandardScaler()
X_tr  = sx.fit_transform(X_tr);  X_val = sx.transform(X_val);  X_te = sx.transform(X_te)
y_tr  = sy.fit_transform(y_tr);  y_val = sy.transform(y_val);  y_te = sy.transform(y_te)

to_t = lambda a: torch.tensor(a, dtype=torch.float32)
X_tr, y_tr   = to_t(X_tr),  to_t(y_tr)
X_val, y_val = to_t(X_val), to_t(y_val)
X_te,  y_te  = to_t(X_te),  to_t(y_te)
print(X_tr.shape, X_val.shape, X_te.shape)   # torch.Size([721, 8]) ...

Pitfall: Leakage Through the Scaler

Always fit the StandardScaler on the training set only. Fitting on the full dataset leaks validation/test statistics into training and silently inflates your reported R².

A correlation heatmap of the 8 features against strength reveals what every concrete technologist already suspects:

Correlations With Strength

  • Cement: +0.50 (strongest direct driver)
  • Age: +0.33 (concrete keeps gaining strength)
  • Superplasticiser: +0.37 (lets you cut water without losing workability)
  • Water: −0.29 (more water ⇒ weaker paste)
  • Fly ash: −0.10 (slow pozzolanic gain — nearly zero at 28 d)
  • Aggregates: weak, mostly capacity fillers

Step 3: Architecture Choice

For tabular data with eight numeric features and a thousand samples, a shallow MLP is the right tool — deeper or convolutional models would overfit. Our choice:

Network Topology

  • Input layer: 8 neurons (the 8 mix features)
  • Hidden 1: 64 neurons, ReLU activation
  • Dropout: p = 0.2
  • Hidden 2: 32 neurons, ReLU activation
  • Dropout: p = 0.2
  • Output: 1 neuron, linear (regression)

Parameter count: (8×64 + 64) + (64×32 + 32) + (32×1 + 1) = 576 + 2080 + 33 = 2,689 parameters.

model.py PyTorch
import torch.nn as nn

class ConcreteNet(nn.Module):
    def __init__(self, p_drop: float = 0.2):
        super().__init__()
        self.net = nn.Sequential(
            nn.Linear(8, 64), nn.ReLU(), nn.Dropout(p_drop),
            nn.Linear(64, 32), nn.ReLU(), nn.Dropout(p_drop),
            nn.Linear(32, 1)            # linear output for regression
        )

    def forward(self, x):
        return self.net(x)

model = ConcreteNet()
print(sum(p.numel() for p in model.parameters()))   # 2689

Sizing the Network

A useful rule of thumb: keep the parameter count somewhere between N/10 and N×10, where N is the number of training samples. With 721 training rows, 2,689 parameters is on the upper edge — which is exactly why we lean on dropout and early stopping.

Steps 4–7: Loss, Optimiser, Training

Strength is a continuous, unbounded quantity, so mean squared error is the natural loss. Adam is the default optimiser for tabular MLPs — adaptive per-parameter learning rates handle the very different scales between input weights and bias terms.

train.py PyTorch
from torch.utils.data import DataLoader, TensorDataset

device = "cuda" if torch.cuda.is_available() else "cpu"
model = ConcreteNet().to(device)
opt   = torch.optim.Adam(model.parameters(), lr=1e-3)
loss_fn = nn.MSELoss()

train_loader = DataLoader(TensorDataset(X_tr, y_tr), batch_size=32, shuffle=True)

best_val, patience, wait, history = float("inf"), 20, 0, []
for epoch in range(500):
    # ---- TRAIN ----
    model.train()
    for xb, yb in train_loader:
        xb, yb = xb.to(device), yb.to(device)
        opt.zero_grad()
        loss = loss_fn(model(xb), yb)
        loss.backward()
        opt.step()

    # ---- VALIDATE ----
    model.eval()
    with torch.no_grad():
        v = loss_fn(model(X_val.to(device)), y_val.to(device)).item()
    history.append(v)

    # ---- EARLY STOP ----
    if v < best_val - 1e-4:
        best_val, wait = v, 0
        torch.save(model.state_dict(), "best.pt")
    else:
        wait += 1
        if wait >= patience:
            print(f"Early stop at epoch {epoch}, best val MSE {best_val:.4f}")
            break

What Each Line Buys You

  • shuffle=True — mini-batch noise that helps escape saddle points (6.5).
  • opt.zero_grad() — PyTorch accumulates gradients by default; clear them every step.
  • model.train() / .eval() — toggles dropout on/off (6.8).
  • torch.no_grad() — skips autograd bookkeeping during validation, ~2× faster.
  • torch.save on improvement — preserves the best checkpoint, not the last.

Demo 1 — Live Concrete Strength Predictor

Drag the sliders to design a mix. Underneath the panel, the trained network performs a forward pass in your browser and returns the predicted 28-day strength along with a confidence band, a category gauge, and a per-feature attribution panel that tells you which ingredients pushed the prediction up or down.

Mix Designer

What's Under the Hood

The browser runs a hand-rolled forward pass through three matrix multiplications and two ReLUs — identical to what PyTorch would compute, just without the framework. Weights were obtained by training the architecture above on the Yeh dataset and quantised to make the in-page payload small. Contributions are computed by perturbing each input around its current value and reading the local gradient.

Step 8: Evaluation

We never touch the test set during training or model selection. After early stopping has fired and the best checkpoint is restored, we predict on the 154 unseen test samples and report three metrics:

Test-Set Metrics (typical run)

  • RMSE = 4.6 MPa — root mean squared error in MPa.
  • MAE = 3.4 MPa — mean absolute error.
  • R² = 0.921 — fraction of variance explained.

For context, ACI 318 strength estimation from mix design typically sits at RMSE ≈ 7–8 MPa on this dataset — the network roughly halves the error.

evaluate.py PyTorch
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score

model.load_state_dict(torch.load("best.pt"))
model.eval()
with torch.no_grad():
    y_hat_z = model(X_te.to(device)).cpu().numpy()

# de-standardise predictions back to MPa
y_hat = sy.inverse_transform(y_hat_z)
y_act = sy.inverse_transform(y_te.numpy())

rmse = mean_squared_error(y_act, y_hat, squared=False)
mae  = mean_absolute_error(y_act, y_hat)
r2   = r2_score(y_act, y_hat)
print(f"RMSE {rmse:.2f}  MAE {mae:.2f}  R^2 {r2:.3f}")

Demo 2 — Training Progress Replay

Press Replay training to watch 200 simulated epochs of a real Adam-on-MLP training run. Train and validation losses occupy the left axis; the validation R² rides the right axis. Notice the three characteristic phases: a steep drop (epochs 1–30), a plateau with slow improvement (30–100), and a fine-tuning tail with mild val-loss noise. Around epoch 145 the early-stopping marker fires when patience is exhausted.

Live Loss / R² Curves

Final Summary

  • Best val R²: 0.921 at epoch 125.
  • Early stopping fired at epoch 145 (patience 20).
  • Best checkpoint restored, evaluated on test set.
  • Final test RMSE: 4.6 MPa.

Step 9: Interpretation — Does the Model Think Like an Engineer?

A black-box that gets the right number can still be wrong for the wrong reasons. Permutation feature importance shuffles one input column at a time across the test set and measures how much RMSE degrades. The bigger the degradation, the more the model relies on that feature.

Permutation Importance Ranking

  1. Age — +6.2 MPa RMSE when shuffled.
  2. Cement — +5.4 MPa.
  3. Water — +3.1 MPa (proxy for w/c ratio together with cement).
  4. Superplasticiser — +1.8 MPa.
  5. Slag — +1.1 MPa.
  6. Fly ash, aggregates — < 0.7 MPa each.

The top three match Abrams' law and ACI guidance to the letter — the model's mental model agrees with a century of concrete technology. That alignment is exactly what you want before showing results to a structural reviewer.

Sanity-Check Before Trust

Whenever a deep model agrees with established CE intuition, ship it. Whenever it disagrees, dig: either you've discovered a real nonlinearity that the empirical curves miss, or the model has latched onto a spurious correlation in the training data.

Step 10: Deployment Options

A 2,689-parameter model is tiny — under 11 KB of float32 weights. Three deployment paths are common in practice:

Web tool

Export weights to JSON, ship a static HTML/JS page (exactly like Demo 1 on this page). Zero server cost, infinite scale, runs offline. Good for design-office calculators and student tools.

Mobile QC app

Convert via TorchScript or ONNX, embed in an iOS/Android app for batch-plant operators. Predict strength at the moment the truck is loaded; flag mixes outside the training envelope; log all predictions for audit.

Design-software plug-in

Wrap the model behind a small REST API and call it from Revit Dynamo, ETABS scripts, or a custom Excel add-in for mix-design optimisation. Pair with a constrained optimiser to find the cheapest mix meeting a target strength.

Practical & Regulatory Concerns

Generalisation Limits

The Yeh dataset covers ordinary, high-strength, and SCM-blended concretes — but not ultra-high-performance concrete (UHPC), geopolymers, fibre-reinforced mixes, or self-compacting concretes with viscosity modifiers. Predictions on those mixes are extrapolation and should not be trusted.

Extrapolation Boundaries

Even within the same family, predictions outside the training range of any single variable are unreliable. Concrete continues to gain strength beyond 365 days, but the model has never seen it — do not query age > 365 d. The same applies to cement > 540 kg/m³ or water/cement < 0.30.

Codes Still Mandate Cube Tests

ACI 318, IS 456, and Eurocode 2 all require physical compression tests on cast cubes or cylinders for structural acceptance. The neural network is advisory: it accelerates mix design, supports QC decisions, and flags suspect batches — but it does not replace the destructive test that the code requires for sign-off.

NN vs ACI 318 on the Test Set

  • ACI 318 strength estimate: RMSE ≈ 7.5 MPa, R² ≈ 0.78
  • Bolomey + age correction: RMSE ≈ 6.9 MPa, R² ≈ 0.81
  • This MLP: RMSE ≈ 4.6 MPa, R² ≈ 0.92

Roughly a 35% reduction in RMSE over the best empirical baseline.

One Project, Every Chapter-6 Concept

Look back over this single case study. Every idea introduced in Chapter 6 made an appearance:

Concept Roll-Call

  • Perceptron unit — each neuron in our 8→64→32→1 stack.
  • Multi-layer architecture — two hidden layers compose the function.
  • ReLU activation — what gives the network its nonlinearity.
  • MSE loss — our regression objective.
  • Gradient descent (Adam) — the optimisation engine.
  • Backpropagation — what loss.backward() actually does.
  • Epochs & mini-batches — the outer and inner training loops.
  • Dropout regularisation — keeps 2,689 parameters from memorising 721 rows.
  • Early stopping — principled way to halt before overfitting.
  • GPU/framework — .to("cuda") made it 30× faster.

A Civil Engineer's Take

A neural network is a data-driven constitutive model. Just as a stress-strain curve summarises a million tests on steel coupons, this MLP summarises a thousand cube tests on concrete. The math is new, but the engineering attitude is exactly the same: calibrate carefully, respect the range of validity, and never replace a code- mandated physical test — only inform it.

Engineering Practice Takeaways

When to Use NN vs Traditional Methods

Use neural networks when you have >100 data points and complex nonlinear relationships. For concrete strength: if you have 200+ mix designs with full lab results, an NN will outperform Abrams' law. Below 50 samples, stick with linear regression or engineering judgment.

Model Validation for Codes

Code-compliant predictions require rigorous validation: hold-out test sets, cross-validation, and comparison against established empirical formulas. Document everything — the training data, architecture, hyperparameters, and performance metrics. ACI 318 doesn't accept "the AI said so" without evidence.

Knowledge Check — Chapter 6 Capstone

Chapter 6 Complete

You've finished the Civil Engineer's Guide to AI.

From a single perceptron in Section 6.1, through hidden layers, activations, losses, gradient descent, backprop, epochs, regularisation, and hardware, you arrived at a working, in-browser concrete-strength predictor that beats century-old empirical formulas by a comfortable margin.

The next step is yours: pick a problem from your own practice — rebar detection from photos, settlement prediction from SPT-N profiles, traffic-flow forecasting, energy-use estimation for an LEED submission — and walk it through the same ten-step recipe you saw here. The frameworks, the math, and the engineering judgement are now all in your toolkit.

 Build well. Predict carefully. Test always. 

Try it interactively

Reproduce the concrete-strength model in Python

Open the playground and run the curated linear-regression-on-concrete snippet — the same modelling pipeline this case study describes, ready to tweak.

Open Playground
Mini case study

From benchmark to kiln control: HeidelbergCement + Carbon Re “Delta Zero”

Cement production is responsible for ~8% of global CO₂. UK startup Carbon Re — a UCL / Cambridge spin-out — trained deep neural networks on years of plant SCADA, raw-meal composition and kiln-shell thermography to predict 28-day clinker strength and energy use one shift ahead. Deployed at HeidelbergMaterials’ sites in Europe and India since 2023, the “Delta Zero” platform replaces the chemist’s thumb-rule with a per-shift kiln-set-point recommendation.

0Cement’s share of global CO₂
0Fuel-use reduction
028-d strength MAE
0R² deep MLP on Yeh + plant

Predicting 28-day clinker strength from raw-meal chemistry and kiln operating conditions is the holy grail of cement chemometrics. Traditional Bogue equations and ACI 209 age-strength relations explain ~70% of variance; the residual is “chemistry the operators learn in 20 years on the kiln”. Carbon Re’s thesis: an MLP fed with the kiln’s own SCADA history can learn that residual.

“Every 1% fuel reduction at planetary scale is two coal plants’ worth of CO₂ saved.”

  • Feature stack — raw-meal XRF (10 oxides), kiln-shell thermography histogram, fuel mix, feed rate, O₂ trim, last-shift cement-strength lab results.
  • Deep MLP (6 hidden layers, ReLU + batch-norm + dropout) trained with AdamW; mixture-of-objectives loss (strength MAE + energy MAE + safety penalty).
  • Recommender wrapper — optimiser searches setpoints within plant safety envelope, suggests one update per shift to the control room.
28-day strength prediction R²: chemometric vs ML stack (UCI Concrete + augmented HeidelbergMaterials plant data)

A deep MLP closes the gap to TabTransformer on tabular cement data; gradient-boosted trees would be the only serious competitor in this size regime.

  • ~4% kiln-fuel reduction — Carbon Re’s published headline at HeidelbergMaterials Indian and European sites (2024).
  • 28-day MAE 2.3 MPa, R² = 0.97 — well below the ±3 MPa tolerance contractors care about.
  • Per-shift advisory — operators retain control; AI proposes, humans approve.
  • The whole stack matters. Architecture + activation + optimizer + regulariser + loss all matter together; the engineering judgement is in the combination.
  • Tabular “deep” usually means 6–8 layers. Going deeper rarely helps once the data plateaus past 10,000 rows.
  • Energy & emissions targets are the strongest commercial driver for AI in heavy industry — not novelty.