Splunk® Cloud Services

SPL2 Search Reference

Acrobat logo Download manual as PDF


Acrobat logo Download topic as PDF

fit command overview

Use the fit command to fit and apply a machine learning model to search results. The fit command is part of the Splunk Machine Learning Toolkit app.

Syntax

The first argument for the algorithm is required. The options following the algorithm vary depending on the algorithm chosen. The required syntax is in bold.

| fit <algorithm> [option_name]=[option_value]... [into <model_name>]

Syntax details

For details about the fit command syntax, see Search commands for machine learning in the Splunk Machine Learning Toolkit User Guide.

Usage

Differences between SPL and SPL2 for the fit command.

Version Example
SPL fit RandomForestClassifier vehicle_name from engine_size
SPL2 fit "RandomForestClassifier" `vehicle_name` from `engine_size`
SPL fit DecisionTreeRegressor temperature from date_month date_hour
SPL2 fit "DecisionTreeRegressor" `temperature` from `date_month`, `date_hour`

Examples

The algorithm name must be in double quotation marks and immediately follow the fit command. Target and features fields must be in single quotation marks with multiple feature fields separated by commas. The keyword clauses from, into, and as must be included in the search in the order of from first, into second, and as last.

The following example includes the from clause, a target field, and multiple feature fields.

| fit "LogisticRegression" 'species' from 'petal_length', 'petal_width'

The following example includes the from and as clauses, a target field, and multiple feature fields.

| fit "LogisticRegression" 'species' from 'petal_length', 'petal_width' as 'new_petal_field'

The following example includes the from, into, and as clauses, a target field, and multiple feature fields.

| fit "LogisticRegression" 'species' from 'petal_length', 'petal_width' into "iris_model" as 'new_petal_field'

Last modified on 31 October, 2020
PREVIOUS
fieldsummary command examples
  NEXT
flatten command overview

This documentation applies to the following versions of Splunk® Cloud Services: current


Was this documentation topic helpful?

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters