What each model is, what it was measured at, where it is weak, and how to call it. Numbers on this page come from held-out evaluation runs, not from aspiration.
Five minutes, in this order. Each step is designed to show that a real model is on the other end.
/api/health, which loads all three models and runs a real
inference through each. The millisecond timings are measured per request.
Open to 0.
The forecast collapses toward zero. No formula was told to do that — a closed
store sells nothing, and the model learned it from Rossmann's history.
| Field | Value |
|---|---|
| Model | RandomForestClassifier — 160 trees, max_depth 12, min_samples_leaf 25, class_weight balanced |
| Training data | approach_train.csv — 116,058 rows, 30 features after encoding |
| Target | mx — inverted: 1 = good loan, 0 = delinquent |
| Class balance | 69.0% mx=1 / 31.0% mx=0 |
| Held-out AUC | 0.7209 (25% split, stratified, seed 42) |
| Majority baseline | AUC 0.500 · accuracy 0.690 |
| Accuracy | 0.664 — below the 0.690 majority baseline, by design |
Predicting "good loan" for everyone scores 69% accuracy and catches zero
delinquencies. class_weight='balanced' makes the model pay for
missing the minority class, which costs raw accuracy and buys ranking ability
— AUC 0.72 versus 0.50. For triage, ranking is the useful property. Anyone
quoting accuracy alone on a 69/31 split is quoting the baseline.
| Feature | Importance | Reading |
|---|---|---|
| total_on_time_payments | 0.364 | Payment history |
| total_late_payments | 0.262 | Payment history |
| current_dpd | 0.136 | Payment history |
| avg_payment_delay | 0.105 | Payment history |
| Annual Income | 0.016 | Marginal |
| borrower_credit_score | 0.015 | Effectively unused |
Payment history is 87% of total importance. Credit score is 1.5%, and its raw
correlation with the target is +0.0018. On a real lending book credit
score is the canonical predictor of delinquency, so a near-zero correlation is a
strong signal that this dataset is synthetic or scrambled in its demographic
columns. Treat the model as a demonstration of a working pipeline, not as a
credit policy.
pd.get_dummies(..., drop_first=True) on a single row at inference.
One row has one category, drop_first drops it, and the reindex filled
every dummy with 0 — so all six categorical inputs silently collapsed to their
reference level. Encoding is now explicit against the fitted columns.
tabpfn.pkl. It is, and always
was, a RandomForest — see On TabFM.
| Field | Value |
|---|---|
| Models | CatBoostRegressor · LGBMRegressor · Ridge — all three deployed |
| Task | Predict units sold for a store/item on a date |
| Features | store, item, month, day, dayofweek, dayofyear, weekofyear |
| History | train2.csv — 913,001 rows, 2013-01-01 → 2017-12-31, 10 stores × 50 items |
| Baseline source | Measured per store/item, seasonal by month where available |
The previous version reported a "conversion probability" and an uplift built
from store_id % 10, item_id % 20 and
0.8 + (store_id % 7) * 0.1, with source comments reading "simulate
store quality impact" and "simulate item appeal". These are arbitrary
arithmetic on identifiers — store 8 scored above store 7 because 8 % 7 is 1 —
and they were presented in the UI as model output.
Uplift is now measured against the real historical mean for that store and item. Conversion probability is gone: no dataset in this project contains impressions, clicks or conversions, so there is nothing to estimate it from, and a number with no source is worse than a blank.
Channel selection is a documented rule, not a prediction, and the UI labels it as
one. Uplift bands: high ≥ +15%, moderate 0–15%, low < 0%. Volume bands: high ≥ 60
units, moderate 25–60, low < 25. The pair selects a channel; cost per contact is a
configurable planning input in prism/campaign_rules.py. Separating the
model output from the business rule is the point — both are legitimate, and
conflating them is what made the old version misleading.
| Field | Value |
|---|---|
| Model | XGBRegressor, selected by RandomizedSearchCV (10 candidates, 3-fold) |
| Tuned params | max_depth 10 · learning_rate 0.2 · min_child_weight 5 · gamma 0.1 · colsample_bytree 0.7 |
| Task | Daily store sales (Rossmann) |
| Features | 17 — promo, competition, calendar, store type, assortment |
| Validation split | Time-based: train < 2015-06-19, test ≥ 2015-06-19 |
A time-based split is the right call for a forecasting task — a random split lets the model see the future of the series it is predicting. Held-out error was not recorded in the shipped artifact, so no accuracy figure is quoted here rather than one being invented. Recovering it needs a rerun of the training script.
Sales cannot be negative. This is an unclamped regressor: nothing constrains
its output to be positive, so with Open = 0 it lands slightly past
zero instead of exactly on it (measured: −0.3 closed against 89.0 open with a
promotion). The raw value is displayed rather than clipped, because a zero
forced by the interface would look identical whether the model had learned
anything or not. The gap between −0.3 and 89.0 is the model demonstrating it
learned what closing a store does.
The loan artifact ships as models/tabpfn.pkl and loads as
sklearn.ensemble.RandomForestClassifier. The code that produced it
trains a RandomForest as a fallback and saves it under that filename; the
tabpfn package is imported nowhere that runs. Earlier documentation
stated "TabPFN foundation model integration" as fact. That claim was not true,
and it has been corrected rather than carried forward.
TabPFN was evaluated for this deployment and ruled out on a hard constraint: it requires PyTorch (~2 GB installed) against a 250 MB serverless budget. It cannot serve real-time predictions on this URL under any arrangement — roughly 8× over budget before the model weights are counted.
If the worklet brief requires a tabular foundation model, the honest options are
to run TabPFN offline and publish the comparison as a result, or to move
inference to a host with room for PyTorch. What is not an option is
leaving a RandomForest named tabpfn.pkl and describing it as a
foundation model. The RandomForest is a reasonable choice here and needs no
cover story: AUC 0.72 on 116k rows, 4.4 MB, single-digit millisecond inference.
All prediction endpoints accept form-encoded or JSON bodies and return JSON.
# Loan — any omitted field falls back to its training median
curl -X POST https://samsung-dashboard-worklet-8.vercel.app/api/loan/predict \
-H 'Content-Type: application/json' \
-d '{"borrower_credit_score": 610, "current_dpd": 45,
"total_late_payments": 14, "total_on_time_payments": 3}'
# Campaign — compare=1 scores all three models on the same input
curl -X POST https://samsung-dashboard-worklet-8.vercel.app/api/campaign/predict \
-d 'store=3&item=12&month=12&day=20&model=catboost&compare=1'
# Sell-out
curl -X POST https://samsung-dashboard-worklet-8.vercel.app/api/sellout/predict \
-d 'Open=1&Promo=1&DayOfWeek=6&StoreType=d&Assortment=c&WeekOfYear=50'
# Batch — CSV in, CSV out, up to 2000 rows
curl -X POST https://samsung-dashboard-worklet-8.vercel.app/api/loan/batch \
-F 'file=@applications.csv' -o scored.csv
# Health — loads every model and runs a real inference through each
curl https://samsung-dashboard-worklet-8.vercel.app/api/health
# Manifest — measured drift of each deployed graph vs its original
curl https://samsung-dashboard-worklet-8.vercel.app/api/models
{
"probability_of_default": 0.5281,
"risk_band": "Critical",
"prediction": "Delinquent",
"drivers": [
{"feature": "total_on_time_payments", "value": 3.0, "median": 9.0,
"importance": 0.364, "direction": "raises risk"}
],
"inference_ms": 1.84,
"model": {"type": "RandomForestClassifier", "n_estimators": 160, "max_depth": 12}
}