Cost-to-complete is the number that decides whether a construction job is healthy, and in most firms it is still produced once a month by a project manager with a spreadsheet and a lot of optimism.

This post walks through building an independent, weekly forecast on top of construction ERP data. It is the machine-learning companion to our full guide on ERP software for the construction industry.
What we are predicting
For each active job and cost code, predict the final cost at completion. Compare it to the project manager's forecast and to budget. The output that matters is not the number itself but the divergence: jobs where the model expects meaningfully more cost than the PM does.
Prerequisites (the honest part)
You need history:
-
Several years of closed jobs.
-
A consistent cost-code structure across those jobs (or a mapping table that normalises old codes).
-
Weekly or monthly snapshots of percent complete, budget, committed cost and actual cost.
If those snapshots do not exist, you can reconstruct many of them from posting dates, but percent-complete history is often missing. In that case, start capturing it now and run a simpler model until you have enough data.
Feature set
Per job, per cost code, per weekly snapshot:
| Feature | Why it helps |
|---|---|
| percent_complete | Where we are in the job |
| actual_to_budget | Burn so far |
| committed_to_budget | Future cost already locked in |
| labor_hours_per_unit trend | Productivity drift |
| pending_change_value / contract | Unapproved exposure |
| budget_revision_count | Volatility signal |
| job_type, size band, region | Similar-job patterns |
| weeks_since_start / planned_duration | Schedule pressure |
Training sketch
import pandas as pd
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.model_selection import GroupKFold
snap = pd.read_parquet("job_cost_snapshots.parquet") # one row per job/code/week
final = pd.read_parquet("final_costs.parquet") # job/code -> final_cost
df = snap.merge(final, on=["job_id", "cost_code"])
df["target"] = df["final_cost"] / df["budget"] # predict overrun ratio
features = ["percent_complete", "actual_to_budget", "committed_to_budget",
"productivity_trend", "pending_change_ratio", "budget_revision_count",
"duration_ratio"]
model = GradientBoostingRegressor(n_estimators=400, max_depth=4)
cv = GroupKFold(n_splits=5)
for train, test in cv.split(df, groups=df["job_id"]): # never leak a job across folds
model.fit(df.iloc[train][features], df.iloc[train]["target"])
Two things to notice. Predict a ratio to budget rather than raw dollars so jobs of different sizes are comparable. And split folds by job, otherwise the model sees future snapshots of the same job and looks far better than it is.
Scoring and alerts
Each week:
-
Pull the latest snapshot for every active job and cost code from the analytics store.
-
Predict the overrun ratio and convert to an expected final cost.
-
Roll up to job level and compare with the PM's forecast.
-
Raise an alert when the gap exceeds a threshold, for example a few percentage points of margin.
alerts = jobs[(jobs.model_margin - jobs.pm_margin) < -THRESHOLD]
Send the alert as an exception report, not a dashboard nobody opens. Include the top contributing cost codes and features so the conversation starts from evidence.
Explaining the prediction
A forecast that nobody can interrogate will be ignored. For each alert, compute feature contributions (SHAP values work well with gradient-boosted trees) and show the top three drivers in plain words, for example "committed cost is running well ahead of percent complete on concrete" or "labour hours per unit have risen for several weeks in a row". That turns the alert into a specific question a project manager can answer, rather than an accusation from a black box. Keep a small feedback field so PMs can mark an alert as explained, which gives you labelled data for tuning thresholds later.
Governance
-
The model never changes the forecast in the ERP. The PM still owns it.
-
Log every prediction, model version and threshold, so you can show auditors and sureties how the signal was produced.
-
Re-train quarterly as jobs close, and monitor error on recently closed jobs.
-
Watch out for drift when your company changes cost-code structure, starts new work types or enters a new region.
Architecture
Keep training and scoring out of the transactional ERP. Stream postings into a warehouse, build the snapshot table there, and run the model as a scheduled job. Results flow back as a report or into a BI tool. If you later add a natural-language assistant, it can read the same warehouse to answer questions like "why does the model think job 2419 is fading?". Our AI development services and custom software development teams build exactly this kind of layer.
For the wider business case, including WIP, retainage, field data and the buy-versus-build decision, read the full construction ERP guide.
Frequently Asked Questions
What is cost-to-complete in construction?
Cost-to-complete is the estimated remaining cost to finish a job or cost code. Added to cost to date, it gives the forecast final cost, which determines expected margin.
What data does an AI cost-to-complete model need?
Closed-job history with consistent cost codes, plus periodic snapshots of percent complete, budget, committed cost, actual cost and pending changes.
Why predict an overrun ratio instead of dollars?
A ratio to budget makes jobs of different sizes comparable and usually improves model stability.
How do you avoid data leakage when training?
Split cross-validation folds by job so that snapshots from the same job never appear in both training and test sets.
Should the AI forecast replace the project manager's forecast?
No. It should run alongside it as an independent signal that flags divergence for discussion.