Algorithms

Lasso

The Lasso algorithm uses the scikit-learn Lasso estimator to fit a model to predict the value of numeric fields. Lasso is like LinearRegression, but it uses L1 regularization to learn a linear models with fewer coefficients and smaller c…

The Lasso algorithm uses the scikit-learn Lasso estimator to fit a model to predict the value of numeric fields. Lasso is like LinearRegression, but it uses L1 regularization to learn a linear models with fewer coefficients and smaller coefficients. Lasso models are consequently more robust to noise and resilient against overfitting. The kfold cross-validation command can be used with Lasso. See, K-fold_cross-validation.

For descriptions of the alpha, fit_intercept, and normalize parameters, see the scikit-learn documentation at http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html.

Parameters

  • The alpha parameter controls the degree of L1 regularization.
  • The fit_intercept parameter specifies whether the model should include an implicit intercept term. The default value is True.

Syntax

fit Lasso <field_to_predict> from <explanatory_fields>
[into <model name>] [alpha=<float>] [fit_intercept=<true|false>] [normalize=<true|false>]

You can save Lasso models using the into keyword and apply new data later using the apply command.

... | apply temperature_model

You can inspect the coefficients learned by Lasso with the summary command.

... | summary temperature_model

Example

The following example uses Lasso on a test set.

... | fit Lasso temperature from date_month date_hour  | ...

Local availability Permalink to this section

  • Local class: Lasso
  • Source file: Splunk_ML_Toolkit/bin/algos/Lasso.py (in-repo path Splunk_ML_Toolkit/bin/algos/Lasso.py)
  • algos.conf stanza: [Lasso]
  • Class bases: RegressorMixin, BaseAlgo

Source Permalink to this section

Adapted from the Splunk AI Toolkit 5.6.4 documentation at /en/splunk-cloud-platform/apply-machine-learning/use-ai-toolkit/5.6.4/algorithms-and-scoring-metrics-in-the-ai-toolkit/algorithms-in-the-ai-toolkit (section: regressor).

Press Cmd/Ctrl+K to focus search. Esc to close.

Type to search the portal.