Feedback:

fit

Use the fit operator to train a machine learning model on AQL search results.

Components

Typically, a machine learning model consists of the following components:-

algorithm

Specifies the name of the machine learning algorithm. Supported algorithms include: 

option_name

Indicates the model parameters. The format is as follows:

option_name=value

Refer to the documentation and examples provided for the particular supported algorithm.

field_to_predict Includes the target field name. Required for supervised models only. Not applicable to unsupervised algorithms.
explanatory_fields Captures the input fields used to train the model. Required for supervised models. Not used for unsupervised models.
kfold_cv

Ensures k-fold cross validation (if the algorithm supports it). When specified, the validation result is returned. Substitute a number of folds for n (minimum value is 2).

Note: This option cannot be used together with into option to save the model.

into Use the into keyword to store the trained model as an artifact that can later be applied using the apply operator.
'model_name'

Denotes the name of the model artifact. The model name must be wrapped in single or double quotation marks.

Usage

The following AQL piped operators are used to manage machine learning models.

AQL Operator Usage
fit Train a machine learning model on AQL search results.
Example 1: Training with Context, Applying with Context Compute predictions for the current search results based on a model that was learned using the fit operator.
listmodels Return a list of machine learning models that were learned using the fit operator.
deletemodel Delete a model that was generated by the fit operator.
ml_model_summary Retrieve metadata about a model that was generated by the fit operator.

Examples

Example 1: Fit a linear regression model to data.

Copy
|fit LinearRegression species from petal_length petal_width sepal_length sepal_width into 'iris_linear_regression_model'

Example 2: Build a classification model.

Copy
|fit LinearRegression species from petal_length petal_width sepal_length sepal_width kfold_cv=5

Example 3: Apply trained model to new data.

Copy
|fit LogisticRegression species from petal_length petal_width sepal_length sepal_width into 'iris_logistic_regression_model'

Example 4: Generate predictions from model.

Copy
|fit LogisticRegression species from petal_length petal_width sepal_length sepal_width kfold_cv=5