You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0786b26
Browse filesBrowse the repository at this point in the historyBrowse files
docs: fit/predict/backtest reference, skills, and receipts
Document the new surface for a first-time reader: the functions reference
(fit/predict/backtest, predict_batch's optional train_query and required
apply_query, the JSON-object-label convention), the models and options pages, the
sqlite-predict / distill-lifecycle / interpret-backtest skills, README, and the
CHANGELOG. Scope the read-only guarantee to the serving functions (registration
writes to _predict_models).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
-- forever: serve the student per row, in microseconds, no runtime attached
112
-
SELECT*FROM predict(NULL, 'SELECT id, tenure, spend FROM customers',
113
-
'{"model":"churn-v1"}');
112
+
SELECT id, predict('churn-v1', tenure, spend) FROM customers;
114
113
115
114
-- the same move for time series: distill a Chronos-class teacher's forecasts
116
115
-- into a DLinear/TiDE student, then serve it through forecast()
@@ -159,25 +158,32 @@ skills-capable agent, or read them as the condensed operator's manual.
159
158
| --- | --- | --- |
160
159
|`forecast(ts, value, horizon [, options])`| Where is this metric going? | an aggregate over your rows: forecast steps with prediction intervals, one JSON document per group |
161
160
|`detect_anomalies(ts, value [, options])`| Which points are abnormal? | an aggregate over your rows: per-point anomaly probability and interval, one JSON document per group |
162
-
|`predict(train_query, apply_query [, options])`| Classify/regress unseen rows | a prediction and confidence per row, zero-shot from in-context examples |
163
-
|`distill_predict(train_query [, options])`| Compress a slow teacher into a fast student | a tiny native model (decision tree or gradient-boosted forest), registered and ready for `predict()`|
164
-
|`distill_forecast(train_query [, options])`| Compress a forecast foundation model into a fast student | a native DLinear/TiDE forecast net (a linear skip plus a small residual), registered and ready for `forecast()`|
165
-
|`backtest(query, horizon [, options])`| How accurate is the model here? | per-fold accuracy (MAE, RMSE, MASE, sMAPE) and interval coverage from a rolling-origin evaluation |
166
-
167
-
One calling convention per operation. `forecast` and `detect_anomalies` are
168
-
**aggregates**: your statement supplies the rows, so `WHERE`, joins, bound
169
-
parameters, and `GROUP BY` all compose naturally, from the CLI or from an ORM
170
-
(Drizzle, SQLAlchemy, Diesel). They are **pure functions**: nothing is ever
171
-
written, so they run on read-only databases and inside views. Each group
172
-
returns one JSON document; expand it with `forecast_rows()` /
173
-
`anomaly_rows()`, or `JSON.parse` it in your app. Each language's
161
+
|`backtest(ts, value, horizon [, options])`| How accurate is the model here? | an aggregate over your rows: per-fold MAE, RMSE, MASE, sMAPE and coverage from rolling-origin evaluation |
162
+
|`fit(f1, ..., fN, label [, options])`| Train a model on labeled rows | an aggregate over your rows: a native tabular student, registered by id or returned as a blob |
163
+
|`predict(model, f1, ..., fN [, options])`| Classify or regress a row | a scalar: one prediction per row from a fitted student |
164
+
|`distill_predict(train_query [, options])`| Compress a slow teacher into a fast student | a tiny native model (decision tree, gradient-boosted forest, or MLP), registered and served by `predict`|
165
+
|`distill_forecast(train_query [, options])`| Compress a forecast foundation model into a fast student | a native DLinear/TiDE forecast net (a linear skip plus a small residual), registered and served by `forecast`|
166
+
167
+
One rule for the whole surface. `forecast`, `detect_anomalies`, `backtest`, and
168
+
`fit` are **aggregates**: your statement supplies the rows, so `WHERE`, joins,
169
+
bound parameters, and `GROUP BY` all compose naturally, from the CLI or from an
170
+
ORM (Drizzle, SQLAlchemy, Diesel). The first three are **pure functions**:
171
+
nothing is written, so they run on read-only databases and inside views. Each
172
+
returns one JSON document; expand it with `forecast_rows()` / `anomaly_rows()` /
173
+
`backtest_rows()`, or `JSON.parse` it in your app. `predict` is a **scalar**,
174
+
one prediction per row, so it drops into any `SELECT` beside your other columns.
0 commit comments