Skip to main content
POST
Train a classifier

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
dataset_id
integer<int64>
required

Id of the dataset to train on. The dataset must be active, owned by the calling company, and materialized on a Snowflake data plane.

feature_inputs
object[]
required

Features to train on. Feature names must be unique.

Minimum array length: 1

A feature to train on. feature_type selects how the feature is encoded and which settings it takes.

label_column
string
required

Column holding the training labels. Either a plain column name (e.g. category) or a path into a variant column (e.g. data['category']). The referenced column must exist in the dataset's schema, spelled exactly as it appears there.

model_name
string
required

Name under which the trained model is saved in the model registry. Must consist of only alphanumeric characters and underscores, and be at most 256 characters long.

Maximum string length: 256
Pattern: ^[a-zA-Z0-9_]+$
debug
boolean

Whether the training output should include debug information. Defaults to false.

id_column
string

Column used to track individual rows in training outputs. Same format as label_column. If omitted, the model is trained without row tracking.

model
object

Classifier configuration, e.g. {"type": "logistic_regression", "C": 1.0}. Supported types: logistic_regression, random_forest, gradient_boosting, svm, naive_bayes. Defaults to logistic regression.

model_version
string

Version under which the trained model is saved in the model registry.

random_state
integer<int32>

Random seed for reproducibility.

save_model
boolean

Whether the trained model should be saved to the model registry. Defaults to true.

stratify
boolean

Whether to use a stratified train/test split. Defaults to true.

tags
string[]

Tags attached to the created job.

Required string length: 1 - 255
test_size
number

Fraction of the data held out as the test set. Defaults to 0.2.

Required range: 0 <= x <= 1

Response

OK

job_id
string<uuid>
required

Id of the created training job. Poll the jobs API for status and results.