fit LocalOutlierFactor
Use the LocalOutlierFactor algorithm when you want to identify anomalous data points using the scikit-learn Local Outlier Factor (LOF).
Syntax
fit LocalOutlierFactor [option_name]=[value] <fields> [into
<model name>]
[option_name]=[value]
|
Specify model parameters. The following model parameters are supported:
For information on the model parameters, refer to scikit learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.LocalOutlierFactor.html |
<fields>
|
Specify input fields used to train 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 |
Usage
You can use the LocalOutlierFactor algorithm to identify anomalous data points using the scikit-learn Local Outlier Factor (LOF). This algorithm measures
the local density deviation of a data point with respect to its neighbors. In other words, the algorithm assesses how isolated or different a data point is compared to its local neighborhood. The key
idea is that outliers often have a significantly lower density of neighboring points than the
majority of the data. LocalOutlierFactor performs one-shot learning and is limited to fitting on
training data and returning outliers.
Examples
Example 1: Detect anomalies using LocalOutlierFactor.
|fields petal_length, petal_width, sepal_length,
sepal_width, species <br />|fit LocalOutlierFactor petal_length
petal_width sepal_length sepal_width species
Example 2: Identify outliers in multivariate data.
|fields petal_length, petal_width, sepal_length,
sepal_width, species <br />|fit LocalOutlierFactor n_neighbors=10
with_std=true petal_length petal_width sepal_length sepal_width species
Example 3: Score observations for anomaly detection.
|fields petal_length, petal_width, sepal_length,
sepal_width, species <br />|fit LocalOutlierFactor novelty=true wit