Skip to content

Commit edb743f

Browse files
mstrathmanclaude
andauthored
feat: fit() accepts an optional leading model name (#23)
* feat: fit() accepts an optional leading model name Mirror predict(model, ...) on the training side: fit('churn', f1, ..., fN, label) registers the trained student as 'churn' and returns its id, so the train and serve calls read in parallel with predict('churn', f1, ..., fN). A leading argument is only a name when it is TEXT, and features are numeric, so every existing fit(f1, ..., fN, label [, options]) call is unchanged. The name may still be given as {"register":"churn"}; supplying it both ways is a mistake, not a precedence to resolve, and raises PREDICT_ERR_OPTIONS. The leading name, like the options object, must be constant within a group. Adds adversarial tests (name-given-twice, name-with-no-features) and a parity test that a leading-name model predicts identically to an options-register one. Docs and CHANGELOG updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * refactor: make fit options-arity discount the leading name Address review: the trailing-options detection used a raw argc >= 3, so a JSON-object trailing argument was consumed as options with a leading name but could land as a class label without one. Detect the leading name first and gate options on argc - has_name >= 3, so both forms treat the trailing object the same way. Adds a consistency test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs: correct fit task default and document per-group constancy Address review: the fit reference claimed task is "inferred from the label", but fit defaults to classify and only regresses when task=regress is given explicitly (a real-valued label without it is trained as classification). State the real default. Also document that the leading name and the options object must be constant within an aggregate group. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix: address review on the leading-name change - Reject a model name with an embedded NUL byte (PREDICT_ERR_OPTIONS): it would otherwise be truncated by the mprintf/strcmp path and register a different id than the caller passed. Adds a char(97,0,98) regression test. - Add an adversarial test that a leading name varying within an aggregate group (a CASE over a column) fails loud, exercising the group-constancy contract. - Correct the header comment: a trailing '{...}' is options only once a feature and a label precede it (argc - has_name >= 3); at the lowest arity it is the label. - Docs: state both registration forms (leading id argument or the register option) explicitly, and describe the label as the last argument before the optional options. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent dd6f6be commit edb743f

7 files changed

Lines changed: 221 additions & 43 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- **`fit` accepts an optional leading model name**, mirroring `predict`:
12+
`fit('churn', f1, ..., fN, label)` registers the trained student as `churn` and
13+
returns its id, so the train and serve calls read in parallel with
14+
`predict('churn', f1, ..., fN)`. The name can still be given as
15+
`'{"register":"churn"}'` instead; supplying it both ways raises
16+
`PREDICT_ERR_OPTIONS`. Existing `fit(f1, ..., fN, label [, options])` calls are
17+
unchanged (a leading argument is only a name when it is TEXT, and features are
18+
numeric).
19+
920
### Fixed
1021

1122
- **Forest prediction accumulates the learning-rate product in double**, matching

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ skills-capable agent, or read them as the condensed operator's manual.
159159
| `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 |
160160
| `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 |
161161
| `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 |
162+
| `fit([name,] f1, ..., fN, label [, options])` | Train a model on labeled rows | an aggregate over your rows: a native tabular student, registered under a leading id argument or a `register` option, or returned as a blob |
163163
| `predict(model, f1, ..., fN [, options])` | Classify or regress a row | a scalar: one prediction per row from a fitted student |
164164
| `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` |
165165
| `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` |

‎predict-tabular.c‎

Lines changed: 83 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -855,12 +855,17 @@ static sqlite3_module predictModule = {
855855

856856
/* ======================================================================
857857
* fit() aggregate + predict() scalar: the guessable tabular pair.
858-
* fit(f1, ..., fN, label [, options]) trains a native student over the rows of
859-
* the statement (label is the last positional argument, no target option) and
860-
* returns the plain registered id text when options request registration
861-
* ({"register":"my-id"}), otherwise its serialized model blob. The optional
862-
* trailing options is a TEXT JSON object; a trailing '{...}' is therefore always
863-
* read as options, so a class label must not itself be a JSON-object string.
858+
* fit([name,] f1, ..., fN, label [, options]) trains a native student over the
859+
* rows of the statement (features are numeric and positional, the label is the
860+
* last positional argument, no target option). An optional leading TEXT argument
861+
* names and registers the model, mirroring predict(model, ...); the same name may
862+
* instead be given as {"register":"my-id"}, but supplying it both ways is an
863+
* error. With a name fit() returns the registered id text; with neither it
864+
* returns the serialized model blob. The optional trailing options is a TEXT JSON
865+
* object; once a feature and a label precede it (argc - has_name >= 3) a trailing
866+
* '{...}' is read as options, so a class label at that arity must not itself be a
867+
* JSON-object string. At the lowest arity (a single feature and the label, as in
868+
* fit(x, '{}')) the trailing object is the label.
864869
* predict(model, f1, ..., fN [, options]) serves that student per row, features
865870
* positional, deserialized once and cached on the model argument.
866871
* ====================================================================== */
@@ -912,6 +917,7 @@ static const char *const FIT_OPTION_KEYS[] = {"kind", "student_kind", "task",
912917
typedef struct {
913918
int configured;
914919
int has_opts;
920+
int has_name; /* a leading TEXT model-name argument was present */
915921
char *opts_raw; /* trailing options text of the first row (owned), or NULL */
916922
int nfeat;
917923
int classify;
@@ -952,18 +958,46 @@ static void fit_step(sqlite3_context *ctx, int argc, sqlite3_value **argv) {
952958
}
953959
if (c->err)
954960
return;
955-
/* Determine this row's trailing options: the last argument when it is TEXT
956-
* beginning with '{'. Presence and content must be constant across the group,
957-
* or the feature/label split and the model config would depend on the order
958-
* SQLite happens to visit rows in. Consequence of this convention: the trailing
959-
* '{...}' is ALWAYS the options object, so a class label must not be a JSON
960-
* object string (it would be consumed as options). A malformed options object
961-
* fails loudly at predict0_options_parse; the only quiet case is a label that
962-
* is itself a well-formed, valid-key options object, which is why the label
961+
/* An optional leading model name: a TEXT first argument. Features are numeric,
962+
* so a text argv[0] is unambiguously the register name — the guessable mirror of
963+
* predict(model, ...). Like the options object it must be constant across the
964+
* group, and it is reconciled against {"register":...} below (supplying the name
965+
* both ways is an error, not a silent precedence). Detected before the trailing
966+
* options so the options arity can discount it. */
967+
int has_name = (argc >= 1 && sqlite3_value_type(argv[0]) == SQLITE_TEXT);
968+
const char *name_txt = NULL;
969+
if (has_name) {
970+
name_txt = (const char *)sqlite3_value_text(argv[0]);
971+
if (!name_txt) { /* TEXT value but NULL text pointer means an allocation failed */
972+
c->err = SQLITE_NOMEM;
973+
return;
974+
}
975+
/* The name flows through mprintf("%s") and strcmp below, so an embedded NUL
976+
* would silently truncate it to a different id than the caller passed. Reject
977+
* it rather than register/return the wrong name. */
978+
if (memchr(name_txt, '\0', (size_t)sqlite3_value_bytes(argv[0]))) {
979+
c->err = SQLITE_ERROR;
980+
c->errmsg = sqlite3_mprintf("%s: model name must not contain a NUL byte",
981+
PREDICT_ERR_OPTIONS);
982+
return;
983+
}
984+
}
985+
986+
/* This row's trailing options: the last argument when it is TEXT beginning with
987+
* '{'. It is options only when a feature and a label still precede it after the
988+
* optional name (argc - has_name >= 3); with fewer arguments the trailing '{...}'
989+
* is the label, exactly as the name-less form treats it, so both forms stay
990+
* consistent. Presence and content must be constant across the group, or the
991+
* feature/label split and the model config would depend on the order SQLite
992+
* happens to visit rows in. Consequence: a trailing '{...}' with a feature and
993+
* label present is ALWAYS the options object, so a class label must not be a
994+
* JSON-object string (it would be consumed as options). A malformed options
995+
* object fails loudly at predict0_options_parse; the only quiet case is a label
996+
* that is itself a well-formed, valid-key options object, which is why the label
963997
* contract is documented rather than guessed. */
964998
int has_opts = 0;
965999
const char *opts_txt = NULL;
966-
if (argc >= 3 && sqlite3_value_type(argv[argc - 1]) == SQLITE_TEXT) {
1000+
if (argc - has_name >= 3 && sqlite3_value_type(argv[argc - 1]) == SQLITE_TEXT) {
9671001
const char *t = (const char *)sqlite3_value_text(argv[argc - 1]);
9681002
if (t && t[0] == '{') {
9691003
has_opts = 1;
@@ -972,10 +1006,10 @@ static void fit_step(sqlite3_context *ctx, int argc, sqlite3_value **argv) {
9721006
}
9731007

9741008
if (!c->configured) {
975-
int nfeat = argc - 1 - has_opts;
1009+
int nfeat = argc - has_name - 1 - has_opts;
9761010
if (nfeat < 1) {
9771011
c->err = SQLITE_ERROR;
978-
c->errmsg = sqlite3_mprintf("%s: fit(feature, ..., label [, options])"
1012+
c->errmsg = sqlite3_mprintf("%s: fit([name,] feature, ..., label [, options])"
9791013
" needs at least one feature and a label",
9801014
PREDICT_ERR_SCHEMA);
9811015
return;
@@ -998,6 +1032,16 @@ static void fit_step(sqlite3_context *ctx, int argc, sqlite3_value **argv) {
9981032
return;
9991033
}
10001034
}
1035+
/* The model name is given at most once: a leading argument OR {"register":...},
1036+
* never both — a conflicting pair is a mistake, not a precedence to resolve. */
1037+
if (has_name && o.reg) {
1038+
c->err = SQLITE_ERROR;
1039+
c->errmsg = sqlite3_mprintf(
1040+
"%s: model name given twice (leading argument and \"register\" option)",
1041+
PREDICT_ERR_OPTIONS);
1042+
fit_opts_free(&o);
1043+
return;
1044+
}
10011045
int classify = 1;
10021046
if (o.task) {
10031047
if (strcmp(o.task, "regress") == 0)
@@ -1014,10 +1058,20 @@ static void fit_step(sqlite3_context *ctx, int argc, sqlite3_value **argv) {
10141058
c->classify = classify;
10151059
c->kind = o.kind; /* transfer ownership */
10161060
o.kind = NULL;
1017-
c->reg_id = o.reg;
1018-
o.reg = NULL;
1061+
if (has_name) {
1062+
c->reg_id = sqlite3_mprintf("%s", name_txt);
1063+
if (!c->reg_id) {
1064+
c->err = SQLITE_NOMEM;
1065+
fit_opts_free(&o);
1066+
return;
1067+
}
1068+
} else {
1069+
c->reg_id = o.reg; /* transfer ownership */
1070+
o.reg = NULL;
1071+
}
10191072
fit_opts_free(&o);
10201073
c->has_opts = has_opts;
1074+
c->has_name = has_name;
10211075
if (has_opts) {
10221076
c->opts_raw = sqlite3_mprintf("%s", opts_txt);
10231077
if (!c->opts_raw) {
@@ -1026,11 +1080,13 @@ static void fit_step(sqlite3_context *ctx, int argc, sqlite3_value **argv) {
10261080
}
10271081
}
10281082
c->configured = 1;
1029-
} else if (has_opts != c->has_opts ||
1030-
(has_opts && (!c->opts_raw || strcmp(opts_txt, c->opts_raw) != 0))) {
1083+
} else if (has_opts != c->has_opts || has_name != c->has_name ||
1084+
(has_opts && (!c->opts_raw || strcmp(opts_txt, c->opts_raw) != 0)) ||
1085+
(has_name && (!c->reg_id || strcmp(name_txt, c->reg_id) != 0))) {
10311086
c->err = SQLITE_ERROR;
1032-
c->errmsg = sqlite3_mprintf("%s: options must be constant within a group",
1033-
PREDICT_ERR_OPTIONS);
1087+
c->errmsg = sqlite3_mprintf(
1088+
"%s: fit options and model name must be constant within a group",
1089+
PREDICT_ERR_OPTIONS);
10341090
return;
10351091
}
10361092

@@ -1072,14 +1128,15 @@ static void fit_step(sqlite3_context *ctx, int argc, sqlite3_value **argv) {
10721128
}
10731129
f32 *row = &c->X[(size_t)c->n * c->nfeat];
10741130
for (int i = 0; i < c->nfeat; i++) {
1075-
int t = sqlite3_value_type(argv[i]);
1131+
/* features start after the optional leading name (argv[0]) */
1132+
int t = sqlite3_value_type(argv[has_name + i]);
10761133
if (t != SQLITE_INTEGER && t != SQLITE_FLOAT) {
10771134
c->err = SQLITE_ERROR;
10781135
c->errmsg = sqlite3_mprintf("%s: fit feature %d must be numeric",
10791136
PREDICT_ERR_SCHEMA, i + 1);
10801137
return;
10811138
}
1082-
f64 fv = sqlite3_value_double(argv[i]);
1139+
f64 fv = sqlite3_value_double(argv[has_name + i]);
10831140
if (!isfinite(fv)) { /* 1e999 -> +Inf as SQLITE_FLOAT; NaN poisons splits */
10841141
c->err = SQLITE_ERROR;
10851142
c->errmsg = sqlite3_mprintf("%s: fit feature %d must be finite",
@@ -1088,7 +1145,7 @@ static void fit_step(sqlite3_context *ctx, int argc, sqlite3_value **argv) {
10881145
}
10891146
row[i] = (f32)fv;
10901147
}
1091-
sqlite3_value *lv = argv[c->nfeat];
1148+
sqlite3_value *lv = argv[has_name + c->nfeat];
10921149
if (c->classify) {
10931150
/* A NULL class label is not a real class; fail loudly rather than train a
10941151
* silent empty-string class. A NULL text under memory pressure is NOMEM. */

‎tests/test_fit.py‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,102 @@ def test_fit_register_then_scalar_predict(db):
3535
assert preds == ["1", "1", "0", "0"]
3636

3737

38+
def test_fit_leading_name_rhymes_with_predict(db):
39+
"""The guessable mirror: a leading TEXT model name registers the model, so
40+
fit('id', f..., label) reads parallel to predict('id', f...). Same churn
41+
signal, no options object needed."""
42+
_seed(db)
43+
mid = db.execute(
44+
"SELECT fit('churn-lead', tenure, spend, churned) FROM h").fetchone()[0]
45+
assert mid == "churn-lead"
46+
preds = [r[1] for r in db.execute(
47+
"SELECT id, predict('churn-lead', tenure, spend) FROM a ORDER BY id")]
48+
assert preds == ["1", "1", "0", "0"]
49+
50+
51+
def test_fit_leading_name_composes_with_options(db):
52+
"""A leading name and a trailing options object coexist: the name registers,
53+
the options still select the student kind."""
54+
_seed(db)
55+
mid = db.execute(
56+
"SELECT fit('lead-tree', tenure, spend, churned, '{\"kind\":\"tree\"}')"
57+
" FROM h").fetchone()[0]
58+
assert mid == "lead-tree"
59+
assert db.execute("SELECT predict('lead-tree', 2, 20)").fetchone()[0] == "1"
60+
61+
62+
def test_fit_leading_name_equals_options_register(db):
63+
"""The two ways to name a model are equivalent: a model registered by a
64+
leading name predicts identically to one registered via {"register":...} on
65+
the same rows (same features, same training, deterministic)."""
66+
_seed(db)
67+
db.execute("SELECT fit('lead-eq', tenure, spend, churned) FROM h").fetchone()
68+
db.execute("SELECT fit(tenure, spend, churned, '{\"register\":\"opt-eq\"}')"
69+
" FROM h").fetchone()
70+
lead = [r[0] for r in db.execute(
71+
"SELECT predict('lead-eq', tenure, spend) FROM a ORDER BY id")]
72+
opt = [r[0] for r in db.execute(
73+
"SELECT predict('opt-eq', tenure, spend) FROM a ORDER BY id")]
74+
assert lead == opt
75+
76+
77+
def test_fit_model_name_given_twice_fails_loud(db):
78+
"""A leading name and a {"register":...} option name the model twice. That is
79+
a mistake, not a precedence to resolve silently: fail loudly
80+
(PREDICT_ERR_OPTIONS)."""
81+
_seed(db)
82+
with pytest.raises(sqlite3.OperationalError) as e:
83+
db.execute("SELECT fit('twice-a', tenure, spend, churned,"
84+
" '{\"register\":\"twice-b\"}') FROM h").fetchall()
85+
assert "PREDICT_ERR_OPTIONS" in str(e.value)
86+
87+
88+
def test_fit_leading_name_still_needs_features_and_label(db):
89+
"""A leading name does not substitute for data: fit('id', label) has a name
90+
and a label but no features, and must fail loudly (PREDICT_ERR_SCHEMA)."""
91+
_seed(db)
92+
with pytest.raises(sqlite3.OperationalError) as e:
93+
db.execute("SELECT fit('nofeat', churned) FROM h").fetchall()
94+
assert "PREDICT_ERR_SCHEMA" in str(e.value)
95+
96+
97+
def test_fit_leading_name_varying_within_group_fails_loud(db):
98+
"""The leading name, like the options object, must be constant within an
99+
aggregate group. A first TEXT argument that evaluates to different names
100+
across rows fails loudly (PREDICT_ERR_OPTIONS) rather than silently binding
101+
to whichever row SQLite happened to visit first."""
102+
_seed(db)
103+
with pytest.raises(sqlite3.OperationalError) as e:
104+
db.execute(
105+
"SELECT fit(CASE WHEN tenure < 10 THEN 'lo' ELSE 'hi' END,"
106+
" tenure, spend, churned) FROM h").fetchall()
107+
assert "PREDICT_ERR_OPTIONS" in str(e.value)
108+
109+
110+
def test_fit_leading_name_rejects_embedded_nul(db):
111+
"""A model name with an embedded NUL would be truncated by the C-string path,
112+
registering and returning a different id than the caller supplied. Reject it
113+
loudly (PREDICT_ERR_OPTIONS) instead of silently binding to the prefix."""
114+
_seed(db)
115+
with pytest.raises(sqlite3.OperationalError) as e:
116+
db.execute("SELECT fit(char(97, 0, 98), tenure, spend, churned)"
117+
" FROM h").fetchall()
118+
assert "PREDICT_ERR_OPTIONS" in str(e.value)
119+
120+
121+
def test_fit_leading_name_json_object_still_options(db):
122+
"""The leading name discounts the options arity, so a trailing JSON-object
123+
argument is consumed as options with or without a name: fit('id', f1, f2, obj)
124+
fails loudly (PREDICT_ERR_OPTIONS) just like fit(f1, f2, obj), rather than one
125+
form treating the object as a class label and the other as options."""
126+
db.execute("CREATE TABLE jl2(f1 REAL, f2 REAL, lbl TEXT)")
127+
db.executemany("INSERT INTO jl2 VALUES (?, ?, ?)",
128+
[(i * 1.0, (i % 3) * 1.0, '{"category":"A"}') for i in range(20)])
129+
with pytest.raises(sqlite3.OperationalError) as e:
130+
db.execute("SELECT fit('jlmodel', f1, f2, lbl) FROM jl2").fetchall()
131+
assert "PREDICT_ERR_OPTIONS" in str(e.value)
132+
133+
38134
def test_fit_blob_served_via_cte(db):
39135
"""No registration: fit() returns a model blob, served in one statement."""
40136
_seed(db)

‎website/src/content/docs/guides/operations.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ e.g. `'{"confidence_level":0.9}'`.
1616
| `forecast(ts, value, horizon [, options])` | Where is this metric going? | one JSON document per group: future rows with prediction intervals and a status |
1717
| `detect_anomalies(ts, value [, options])` | Which points are abnormal? | one JSON document per group: anomaly-scored rows with expected value and probability |
1818
| `backtest(ts, value, horizon [, options])` | How accurate is the model here? | one JSON document per group: per-fold MAE / RMSE / MASE / sMAPE and coverage |
19-
| `fit(f1, ..., fN, label [, options])` | Train a model on labeled rows | a registered model id, or a model blob |
19+
| `fit([name,] f1, ..., fN, label [, options])` | Train a model on labeled rows | a registered model id, or a model blob |
2020
| `predict(model, f1, ..., fN [, options])` | Classify or regress a row | a prediction, or a `{prediction, confidence}` document with `proba` |
2121
| `distill_predict(train_query [, options])` | Compress a teacher into a fast student | a registered native tabular model |
2222
| `distill_forecast(train_query [, options])` | Compress a forecast model into a student | a registered native forecast model |

‎website/src/content/docs/reference/functions.md‎

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,30 @@ SELECT avg(mae) FROM backtest_rows(
6565
(SELECT backtest(ts, value, 6, '{"folds":20}') FROM readings));
6666
```
6767

68-
### `fit(f1, ..., fN, label [, options])`
69-
70-
Trains a native tabular student over your rows. The features are the leading
71-
positional arguments and the **label is the last argument** (there is no
72-
`target` option). The optional trailing `options` is a TEXT JSON object, so a
73-
trailing `{...}` argument is always read as options: a class **label must not be
74-
a JSON-object string** (it would be consumed as options). Returns the model:
75-
with `'{"register":"churn-v1"}'` it registers into `_predict_models` and returns
76-
the id, otherwise it returns a model blob you can pass to `predict`. Options:
77-
`kind` (`gbt` default, or `tree`), `task` (`classify`/`regress`, inferred from
78-
the label), `register`.
68+
### `fit([name,] f1, ..., fN, label [, options])`
69+
70+
Trains a native tabular student over your rows. The features are positional and
71+
the **label is the last argument before the optional `options`** (there is no
72+
`target` option). An
73+
optional **leading TEXT argument names and registers the model**, mirroring
74+
`predict(model, ...)` so the train and serve calls read in parallel:
75+
`fit('churn', f..., label)` then `predict('churn', f...)`. The same name can
76+
instead be given as `'{"register":"churn"}'`, but supplying it both ways raises
77+
`PREDICT_ERR_OPTIONS`. With a name, `fit` registers into `_predict_models` and
78+
returns the id; with neither it returns a model blob you can pass to `predict`.
79+
The optional trailing `options` is a TEXT JSON object, so a trailing `{...}`
80+
argument is always read as options: a class **label must not be a JSON-object
81+
string** (it would be consumed as options). Within an aggregate group the leading
82+
name and the `options` object must be constant, or the call raises
83+
`PREDICT_ERR_OPTIONS`. Options: `kind` (`gbt` default, or `tree`), `task`
84+
(`classify` default, or `regress` for a numeric target), `register`.
7985

8086
```sql
87+
-- name the model with a leading id, and fit/predict read in parallel:
88+
SELECT fit('churn-v1', tenure, spend, churned) FROM history;
89+
SELECT id, predict('churn-v1', tenure, spend) AS churn FROM active;
90+
91+
-- or name it in options, alongside the student kind:
8192
SELECT fit(tenure, spend, churned, '{"kind":"gbt","register":"churn-v1"}') FROM history;
8293
```
8394

0 commit comments

Comments
 (0)