fit LogisticRegression
Use the LogisticRegression algorithm when you want to fit a model to predict the value of categorical fields using the scikit-learn logistic regression estimator.
Syntax
fit LogisticRegression [option_name]=[value]... <field_to_predict> from <explanatory_fields> [kfold_cv=n] [into '<model_name>']
[option_name]=[value]
|
Specify model parameters:
For information on the model parameters, refer to scikit learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html |
<field_to_predict>
|
Specify the target field name. |
<explanatory_fields>
|
Specify input fields used to train the model. |
[kfold_cv=n]
|
Specify this option to support kfold validation. When specified, the validation result will be returned. Substitute a number of folds for n. The number of folds must be at least 2. Note: This option cannot be used together with |
into
|
Specify the into keyword to store the learned model in an artifact that can later be applied to new search results with the apply operator. |
'<model_name>'
|
Specify the name of the model to save as an artifact, so that it can be used with the |
Usage
You can use the LogisticRegression algorithm to fit a model to predict the value of categorical fields using the scikit-learn logistic regression estimator. The input training data has to be preprocessed, encoded, and normalized if required before passing to the fit operator. This algorithm supports the kfold cross-validation option.
Examples
Example 1: Train a logistic regression classifier.
|fields petal_length, petal_width, sepal_length, sepal_width, species <br />|fit LogisticRegression species from petal_length petal_width sepal_length sepal_width into 'iris_logistic_regression_model'
Example 2: Build classification model.
|fields petal_length, petal_width, sepal_length, sepal_width, species <br />|fit LogisticRegression species from petal_length petal_width sepal_length sepal_width kfold_cv=5
Example 3: Apply logistic regression for predictions.
|fields petal_length, petal_width, sepal_length, sepal_w