CREATE MODEL
statement creates and trains a machine learning (ML) model.
CREATE MODEL
statement is equivalent to the CREATE PREDICTOR
statement.
We are transitioning to the CREATE MODEL
statement, but the CREATE PREDICTOR
statement still works.Expressions | Description |
---|---|
project_name | Name of the project where the model is created. By default, the mindsdb project is used. |
predictor_name | Name of the model to be created. |
integration_name | Name of the integration created using the CREATE DATABASE statement or file upload. |
(SELECT column_name, ... FROM table_name) | Selecting data to be used for training and validation. |
target_column | Column to be predicted. |
ORDER BY sequential_column | Used in time series models. The column by which time series is ordered. It can be a date or anything that defines the sequence of events. |
GROUP BY partition_column | Used in time series models. It is optional. The column by which rows that make a partition are grouped. For example, if you want to forecast the inventory for all items in the store, you can partition the data by product_id , so each distinct product_id has its own time series. |
WINDOW int | Used in time series models. The number of rows to look back at when making a prediction. It comes after the rows are ordered by the column defined in ORDER BY and split into groups by the column(s) defined in GROUP BY . The WINDOW 10 syntax could be interpreted as “Always use the previous 10 rows”. |
HORIZON int | Used in time series models. It is optional. It defines the number of future predictions (it is 1 by default). However, the HORIZON parameter, besides defining the number of predictions, has an impact on the training procedure when using the Lightwood ML backend. For example, different mixers are selected depending on whether the HORIZON value is one or greater than one. |
engine_name | You can optionally provide an ML engine, based on which the model is created. |
tag_name | You can optionally provide a tag that is visible in the training_options column of the mindsdb.models table. |
FROM
clause is mandatory here.target_column
that will be predicted is a numerical value. The prediction values are not limited to a defined set of values, but can be any number from the given range of numbers.
FROM
clause is mandatory here.target_column
that will be predicted is a string value. The prediction values are limited to a defined set of values, such as Yes
and No
.
FROM
clause is mandatory here.JOIN
statement and join the data table with the model table to get predictions.
FROM
clause here. Instead, the input_column
is defined in the USING
clause.CREATE MODEL
statement, you can check the status of the training process by querying the mindsdb.models
table.