Feedback:

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:

  • penalty={'l1'|'l2'|'elasticnet'|none}

  • dual={true|false}

  • tol=<float>

  • C=<float>

  • fit_intercept={true|false}

  • intercept_scaling=<float>

  • class_weight={'balanced'|None}

  • random_state=<integer>

  • solver={'lbfgs'|'liblinear'|'newton-cg'|'newton-cholesky'|'sag'|'saga'}

  • max_iter=<integer>

  • multi_class={'auto'|'ovr'|'multinomial'}

  • warm_start={true|false}

  • l1_ratio=<integer>

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 option to save the model.

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 apply operator. The model name must be wrapped with single or double straight quotation marks.

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.

Copy
|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.

Copy
|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.

Copy
|fields petal_length, petal_width, sepal_length, sepal_w