Custom Decision Model Proof of Concept: Beat a Dummy Baseline, Tune a Cost Threshold, Then Decide Go or No-Go
A proof of concept for a custom decision model should let current rules and a simple classifier win if they can. Here is a reproducible shipment-review method, with code and a report template.
A custom decision model proof of concept should test one recurring decision, such as whether a shipment gets a manual review, against your current rules and a scikit-learn dummy classifier baseline on later, untouched data. The review threshold should come from business costs tuned on validation data, not from the default cut-off of 0.5. The model goes ahead only if it lowers total operating cost within review capacity, and a prospective pilot then confirms that the gain is real.
That procedure is deliberately modest. Historical data can show that a model is feasible, but only live use can show that it improves operations. A good proof of concept also makes it easy for a rule or a logistic regression to win, because a complex model has to earn its extra cost.
The proof of concept tests one decision, with inputs and success criteria fixed before training
The example decision in this guide is narrow: for each shipment, the system recommends review or proceed. A narrow decision makes every later number easier to interpret. It also keeps the cost model small enough to write down.
Four things need to be agreed in writing before anyone trains a model:
- The team lists the inputs that are known at decision time, because any field filled in after the decision makes the model look better than it can be in use.
- The team writes down how labels are created and where they are incomplete. An issue found by a reviewer is a label, but issues on shipments that nobody reviewed may surface weeks later as claims, or never.
- The operations owner states the review capacity, for example 2,000 reviews a month, which caps how many shipments any policy may send to people.
- The business owner sets the success criteria, for example a lower operating cost than current rules, no more missed issues than current rules, and review volume within capacity.
A dataset with one row per shipment decision is enough. The schema below separates the inputs from the outcome fields, which the model must never see at prediction time.
shipment_id string key
decision_time datetime when the review/proceed call is made
carrier category known at booking
lane category origin-destination group
commodity category declared commodity class
declared_value float from the booking
weight_kg float from the booking
shipper_tenure_days int days since the shipper's first shipment
prior_issues_90d int issues in the 90 days BEFORE decision_time
rule_review 0/1 what the current rules decided
reviewed 0/1 outcome field: was a review actually done
issue 0/1 outcome field: label, observed within 30 days
label_source category outcome field: review, claim or audit
The label limitation can matter more than the choice of model. Under current rules, reviewed shipments are checked closely, while the others are checked only when a claim arrives. Historical labels therefore undercount issues on shipments that the old rules let through. The report should say so in one sentence, and the pilot later measures it directly.
Chronological splits keep the test months untouched until the final run
Shipment data has an order in time, and a random split would let the model learn from next month to predict last month. The guide uses three chronological blocks: the oldest 60% of decisions for training, the next 20% for validation and the newest 20% for the final test. Threshold tuning and model selection use only the first two blocks. The test block is scored once, at the end.
Inside the training block, scikit-learn's TimeSeriesSplit provides the cross validation. Its documentation says that it splits time-ordered data "where other cross-validation methods are inappropriate," because they "would lead to training on future data and evaluating on past data." Each successive training set contains all the earlier ones. The gap parameter drops samples between training and test folds, which helps when a feature such as prior_issues_90d is computed over a window.
A dummy classifier baseline and cross validation show whether any model beats doing nothing
The scikit-learn documentation describes DummyClassifier as "a simple baseline to compare against other more complex classifiers," and says that it "makes predictions that ignore the input features." With the default strategy="prior", it always predicts the most common class and returns the base rate as its probability. With strategy="constant", it can stand in for a fixed policy such as "review nothing" or "review everything."
The comparison set for a first proof of concept has four members:
- The current rules are scored exactly as they ran, because they are the policy that any model replaces.
- A dummy classifier shows the score of a policy that uses no shipment information.
- A logistic regression gives a probability for each shipment and is easy to inspect coefficient by coefficient.
- A small decision tree, limited to a depth of four, gives readable rules that the operations team can check.
cross_validate runs each candidate over the TimeSeriesSplit folds and returns fit_time, score_time and one array per metric. A model that does not clearly beat the dummy classifier on the probability metrics has learned little. A model that beats the dummy but not the current rules on cost is not worth deploying.
These simple models are enough when the inputs are structured fields and the decision has two outcomes. Booking fields such as carrier, lane, commodity and declared value fit that description.
Tuning the decision threshold for cost-sensitive learning turns a risk score into a review policy
A classifier produces a probability, and a policy turns that probability into an action. The scikit-learn user guide puts this plainly: "Classification is best divided into two parts," a statistical problem of predicting probabilities and "the decision problem to take concrete action based on those probability predictions." It adds that the default rule of predicting the positive class above 0.5 is "most certainly not ideal for most use cases."
For shipment review, the cost logic is simple. A review is worth doing when the expected loss that it prevents is larger than its cost:
review when P(issue) x review_effectiveness x avoidable_loss > review_cost
Suppose that a review costs $10, a missed issue costs $200, and a review catches 80% of the real issues that it sees. The break-even probability is then 10 / (0.8 x 200), or 6.25%. That figure is an assumption-driven starting point, not a result. Review effectiveness in particular should be measured rather than assumed.
scikit-learn's TunedThresholdClassifierCV searches for the threshold that maximises a business metric passed through make_scorer. Its cost-sensitive learning example does this on German credit data, with a cost of 1 for a false positive and 5 for a false negative. The tuned threshold there was 0.03, and the business score improved from -209 to -143. The same page runs a fraud example in which the tuned threshold of 0.03 lifted the benefit from 244,919.87 euros at the default threshold to 249,433.39 euros.
The documentation also states the rule that prevents overfitting at this step: "You should never use the same data for training the classifier and tuning the decision threshold." The script below trains on the training block, then uses cv="prefit" to tune the threshold on the validation block only. If the tuned threshold would flag more shipments than the review capacity allows, the threshold is raised until the volume fits.
Calibration and deferral are checked separately from cost
A cost-tuned threshold only works as intended if the probabilities mean what they say. The scikit-learn calibration guide defines a well calibrated classifier as one where, among cases given a probability near 0.8, "approximately 80% actually belong to the positive class." calibration_curve bins the predictions and compares the mean prediction in each bin with the observed rate. The guide warns that a lower Brier score "does not necessarily mean a better calibrated model," so the report shows the curve as well as the score.
Logistic regression "is more likely to return well calibrated predictions by itself," according to the same guide, which is another reason to start with it. If a tree or another model needs calibration, the calibrator should be fit on data that is separate from the training data. CalibratedClassifierCV with a FrozenEstimator supports that, provided that the calibration rows stay disjoint from the training rows.
Deferral is a second, separate check. Shipments with a probability very close to the threshold are the ones where the model adds the least certainty. The script sends a narrow band around the threshold back to the current rules. The report then states the deferral coverage, which is the share of decisions that the model handles itself, and the cost with deferral switched on.
The full script runs every step on synthetic shipments
The script below generates synthetic shipments, so every number that it prints is a demonstration of the method and not evidence about any real operation. It uses scikit-learn 1.9.1 APIs. Replace the synthetic block with your own export, keeping the same column names.
"""Shipment review proof of concept. ALL DATA BELOW IS SYNTHETIC."""
import time
import numpy as np
import pandas as pd
from sklearn.calibration import calibration_curve
from sklearn.compose import make_column_transformer
from sklearn.dummy import DummyClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import brier_score_loss, make_scorer
from sklearn.model_selection import (TimeSeriesSplit, TunedThresholdClassifierCV,
cross_validate)
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import OneHotEncoder, StandardScaler
from sklearn.tree import DecisionTreeClassifier
REVIEW_COST = 10.0 # dollars per manual review (assumption)
MISSED_LOSS = 200.0 # avoidable loss per missed issue (assumption)
REVIEW_EFFECT = 0.8 # share of real issues that a review catches (assumption)
CAPACITY = 0.10 # maximum share of shipments sent to review
def operating_cost(y_true, review):
y_true = np.asarray(y_true).astype(int)
review = np.asarray(review).astype(int)
caught = int(((y_true == 1) & (review == 1)).sum())
missed = int(y_true.sum()) - caught
loss = (missed + caught * (1 - REVIEW_EFFECT)) * MISSED_LOSS
return review.sum() * REVIEW_COST + loss
def negative_cost(y_true, y_pred):
return -operating_cost(y_true, y_pred)
cost_scorer = make_scorer(negative_cost)
# 1. Synthetic shipments, one row per decision, in time order.
rng = np.random.default_rng(0)
n = 20_000
df = pd.DataFrame({
"decision_time": pd.date_range("2025-01-01", periods=n, freq="26min"),
"carrier": rng.choice(["A", "B", "C", "D"], n),
"lane": rng.choice(["domestic", "eu", "asia", "americas"], n),
"commodity": rng.choice(["general", "electronics", "chemicals", "food"], n),
"declared_value": rng.lognormal(7, 1, n).round(2),
"weight_kg": rng.gamma(2.0, 15.0, n).round(1),
"shipper_tenure_days": rng.integers(0, 2000, n),
"prior_issues_90d": rng.poisson(0.2, n),
})
logit = (-4.0 + 0.8 * (df.commodity == "chemicals") + 0.5 * (df.lane == "asia")
+ 0.4 * np.log1p(df.declared_value / 1000) + 0.6 * df.prior_issues_90d
- 0.0008 * df.shipper_tenure_days)
df["issue"] = (rng.random(n) < 1 / (1 + np.exp(-logit))).astype(int)
df["rule_review"] = ((df.declared_value > 5000) | (df.prior_issues_90d > 0)).astype(int)
# 2. Chronological splits: 60% train, 20% validation, 20% untouched test.
features = ["carrier", "lane", "commodity", "declared_value", "weight_kg",
"shipper_tenure_days", "prior_issues_90d"]
i1, i2 = int(0.6 * n), int(0.8 * n)
train, val, test = df.iloc[:i1], df.iloc[i1:i2], df.iloc[i2:]
X_tr, y_tr = train[features], train["issue"]
X_va, y_va = val[features], val["issue"]
X_te, y_te = test[features], test["issue"].to_numpy()
def prep():
return make_column_transformer(
(OneHotEncoder(handle_unknown="ignore"), ["carrier", "lane", "commodity"]),
remainder=StandardScaler())
# 3. Baselines and simple models, cross-validated in time order.
candidates = {
"dummy_prior": DummyClassifier(strategy="prior"),
"logistic": make_pipeline(prep(), LogisticRegression(max_iter=1000)),
"small_tree": make_pipeline(prep(), DecisionTreeClassifier(
max_depth=4, min_samples_leaf=100, random_state=0)),
}
for name, model in candidates.items():
res = cross_validate(model, X_tr, y_tr, cv=TimeSeriesSplit(n_splits=5),
scoring={"brier": "neg_brier_score", "auc": "roc_auc"})
print(name, "brier", -res["test_brier"].mean().round(4),
"auc", res["test_auc"].mean().round(3))
# 4. Fit on train; tune the cost threshold on validation only.
model = candidates["logistic"].fit(X_tr, y_tr)
tuned = TunedThresholdClassifierCV(model, scoring=cost_scorer, cv="prefit",
refit=False, thresholds=200).fit(X_va, y_va)
p_va = model.predict_proba(X_va)[:, 1]
threshold = max(tuned.best_threshold_, np.quantile(p_va, 1 - CAPACITY))
print("break-even", REVIEW_COST / (REVIEW_EFFECT * MISSED_LOSS),
"tuned", round(tuned.best_threshold_, 4), "used", round(threshold, 4))
# 5. Score every policy once on the untouched test block.
p_te = model.predict_proba(X_te)[:, 1]
policies = {
"review_none": np.zeros(len(y_te), dtype=int),
"review_all": np.ones(len(y_te), dtype=int),
"current_rules": test["rule_review"].to_numpy(),
"model_policy": (p_te >= threshold).astype(int),
}
rows = [{"policy": k, "reviews": int(v.sum()),
"missed": int(((y_te == 1) & (v == 0)).sum()),
"cost": operating_cost(y_te, v)} for k, v in policies.items()]
print(pd.DataFrame(rows))
# 6. Calibration and deferral, reported apart from cost.
frac_pos, mean_pred = calibration_curve(y_te, p_te, n_bins=10, strategy="quantile")
print("brier", round(brier_score_loss(y_te, p_te), 4))
print(np.c_[mean_pred, frac_pos].round(3))
band = np.abs(p_te - threshold) < 0.02
with_deferral = np.where(band, policies["current_rules"], policies["model_policy"])
print("deferral coverage", round(1 - band.mean(), 3),
"cost with deferral", operating_cost(y_te, with_deferral))
# 7. Uncertainty: bootstrap the cost gap between the model and current rules.
gaps = []
for _ in range(2000):
i = rng.integers(0, len(y_te), len(y_te))
gaps.append(operating_cost(y_te[i], policies["model_policy"][i])
- operating_cost(y_te[i], policies["current_rules"][i]))
print("95% interval, model minus rules", np.percentile(gaps, [2.5, 97.5]).round(0))
# 8. Latency for one decision on this machine (record the hardware).
t0 = time.perf_counter()
model.predict_proba(X_te.iloc[:1])
print("one-row latency ms", round(1000 * (time.perf_counter() - t0), 2))
The bootstrap interval in step 7 should be the first number reviewed at the go/no-go meeting. If the interval for "model minus rules" includes zero, the test block has not shown a saving. The simple bootstrap also treats shipments as independent, so a block bootstrap by week is a sensible refinement for seasonal data.
Keeping the risk score, review policy, authorization and hold separate lets a pilot trace each error to its source
The model's output is a probability. It is not a decision. Keeping four layers apart makes the system auditable and makes each one testable on its own:
- The risk score is the model's probability that a shipment has an issue.
- The review policy converts the score into "review" or "proceed" using the threshold, the capacity cap and the deferral band.
- The authorization step decides who may place a hold, and under what conditions a person can override the recommendation.
- The execution is the hold that the warehouse system actually places, or does not place.
The decision log records all four layers for every shipment: the inputs, the score, the model version, the policy version, the recommendation, who approved or overrode it, what was executed and the eventual outcome. Without that log, a pilot cannot separate a model error from a policy error or a process error.
Packaged decision models and custom tuning are worth testing only for text-heavy inputs or many options
Structured shipment fields and a two-way decision rarely need more than the models above. A larger model becomes worth evaluating when the inputs include free text or images, such as carrier notes, inspection photos or customs documents. The same is true when the system must pick among many possible actions rather than two. In those cases, the comparison set grows to include a prompted general-purpose model and a packaged decision model, scored with the same cost function on the same test block.
Parsec, a small language model lab, publishes one such packaged model, TOD, which it calls a "universal decision model." According to Parsec's TOD page, TOD ranks the next action from a supplied list of allowed actions, generates no free text, and costs $0.30 per 1,000 decisions. Those fees are separate from the costs of any parent model that it sits in front of. The public release pinned for any test should be the one on its Hugging Face model card: LoRA adapters on google/gemma-4-12B-it plus a ModernBERT-base retriever, with the Gemma 4 licence applying to the base weights. Its predict function returns one probability per supplied option, so its output can be thresholded exactly like the logistic regression. The TOD page reports a regression against its own base model on a public benchmark, and Parsec's decision-models page gives no price for custom tuning. No published measurement compares TOD, or any packaged decision model, with a logistic regression on shipment review.
Custom tuning of a larger model is the last option to test, not the first. It makes sense only when an unmodified packaged model and a prompted general model both fall short on the cost metric. The team also needs enough labelled decisions to train and still hold out a clean test block.
The evaluation report keeps every outcome on its own line
A single headline score hides the trade-offs that the operations team cares about. The report template below keeps each outcome separate, with one column per policy: current rules, dummy baseline, logistic regression, small tree and any larger model.
EVALUATION REPORT: shipment review proof of concept
Status: SYNTHETIC DEMONSTRATION | HISTORICAL TEST | PROSPECTIVE PILOT
Dataset: source system, export date, row count, date range per split
Label definition and known gaps: ...
Model and policy versions: library versions, model hash, threshold, deferral band
Hardware and serving setup: CPU/GPU type, batch size, region
Per policy, on the test block:
Missed issues (count and rate) .................. 95% interval
Review volume (count and share of capacity) ....
Decision quality (cost-weighted score) .......... 95% interval
Calibration (curve plus Brier score) ............
Deferral coverage and cost with deferral ........
Latency per decision (median and p95) ...........
Operating cost, itemised:
review labour | missed-issue losses | serving | vendor fees | maintenance
Go/no-go criteria agreed on <date>: ...
Result against each criterion: met / not met
Decision and owner: ...
Performance claims should go outside the team only after a held-out measurement with dataset provenance, uncertainty intervals, hardware, model versions and every serving and review cost is in the report. A synthetic run, like the one above, must carry the word SYNTHETIC on every page where its numbers appear.
The NIST AI RMF Govern, Map, Measure and Manage functions map onto the proof-of-concept artifacts
The NIST AI Risk Management Framework is useful here as a map of responsibilities, not as a sequence of stages or a certification. NIST AI 100-1, dated January 2023, says that the framework "is intended to be voluntary." It also says that its actions "do not constitute a checklist, nor are they necessarily an ordered set of steps," and that functions "may be performed in any order across the AI lifecycle." Govern is described as cross-cutting, "infused throughout the other three functions." NIST's resource center adds that a revised version of AI RMF 1.0 is in progress.
The table maps each function to the deliverables of this proof of concept. Following it does not certify anything. It shows that each responsibility has an owner and an artifact.
| Function | Relevant NIST outcome | Proof-of-concept artifact | Typical owner |
|---|---|---|---|
| Govern | GOVERN 2.1: roles and responsibilities documented | Named owners, override rules, decision log design | Business owner |
| Map | MAP 1.1, 1.5, 3.2: purpose, risk tolerance and error costs documented | Decision definition, cost assumptions, success criteria | Operations lead |
| Measure | MEASURE 2.1, 2.3: test sets, metrics and tools documented | Documented dataset, baseline results, evaluation report | Data scientist |
| Manage | MANAGE 1.1, 2.4: proceed or stop, and a way to disengage | Go/no-go report, rollback switch, pilot plan | Business owner |
MANAGE 1.1 is the go/no-go question in NIST's own words: whether the system "achieves its intended purposes and stated objectives and whether its development or deployment should proceed." MEASURE 1.1 also asks teams to document risks that "will not or cannot be measured," which is where the label gap for unreviewed shipments belongs.
A prospective pilot decides whether the historical gain is real
The historical phase ends with seven reviewable deliverables. They are the documented dataset, the baseline results, the model artifact, the decision policy, the decision log and the go/no-go report. The seventh is a small demonstration interface that shows the inputs, score and recommendation for each shipment. If the report says go, the next step is a prospective pilot rather than a full rollout.
scikit-learn's own cost-sensitive example recommends confirming offline estimates with A/B testing on live data, and a shipment pilot can follow the same idea:
- Run the model in shadow mode for four weeks, logging its score and recommendation while the current rules still decide.
- Review a small random sample of shipments that both policies would let through, which measures the issue rate that historical labels missed.
- Assign a fixed share of shipments, for example one lane, to the model policy while the rest stay on current rules.
- Compare missed issues, review volume and itemised cost between the two groups after the 30-day label window closes.
- Keep a switch that returns every shipment to the current rules within minutes, as MANAGE 2.4 asks.
The random audit sample in step 2 is what turns a historical estimate into an operational one. It is also the only way to learn whether the model's gains came from real issues or from the blind spots in the old labels.
Sources
- scikit-learn, DummyClassifier: https://scikit-learn.org/stable/modules/generated/sklearn.dummy.DummyClassifier.html
- scikit-learn, Tuning the decision threshold for class prediction: https://scikit-learn.org/stable/modules/classification_threshold.html
- scikit-learn, Post-tuning the decision threshold for cost-sensitive learning: https://scikit-learn.org/stable/auto_examples/model_selection/plot_cost_sensitive_learning.html
- scikit-learn, cross_validate: https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.cross_validate.html
- scikit-learn, TimeSeriesSplit: https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TimeSeriesSplit.html
- scikit-learn, Probability calibration: https://scikit-learn.org/stable/modules/calibration.html
- scikit-learn, Release history 1.9: https://scikit-learn.org/stable/whats_new/v1.9.html
- NIST, AI RMF Core: https://airc.nist.gov/airmf-resources/airmf/5-sec-core/
- NIST, AI Risk Management Framework (AI RMF 1.0), NIST AI 100-1: https://nvlpubs.nist.gov/nistpubs/ai/NIST.AI.100-1.pdf
- Parsec, TOD: https://parseclab.ai/tod/
- Parsec, Decision models: https://parseclab.ai/solutions/decision-models/
- Parsec, TOD model card: https://huggingface.co/parsecai/tod