Local Outlier Factor

Local Outlier Factor

Local Outlier Factor is located under Machine Learning (  ) in Anomaly Detection, in the task pane on the left. Use the drag-and-drop method (or double-click on the node) to use the algorithm in the canvas. Click the algorithm to view and select different properties for analysis.

Refer to Properties of Local Outlier Factor.

   

Properties of Local Outlier Factor

The available properties of the Local Outlier Factor are as shown in the figure given below.


The table given below describes the different fields present on the Properties pane of the Local Outlier Factor.

Field

Description

Remark

RunIt allows you to run the node.-
ExploreIt allows you to explore the successfully executed node.-
Vertical Ellipses

The available options are

  • Run till node
  • Run from node
  • Publish as a model
  • Publish code
-

Task Name

It displays the name of the selected task.

You can click the text field to edit or modify the name of the task as required.

Dependent Variable

It allows you to select the variable for which you need to perform the task.

  • Only one data field can be selected.
  • Only a categorical variable is available.

Independent Variables

It allows you to select the experimental or predictor variable(s).

Multiple data fields can be selected.

Advanced

No. of Neighbors

It allows you to enter the number of neighboring data points.

  • Only numerical values can be entered.
  • The default value is 20.

Algorithm

 

It allows you to select the algorithm used for the search for the Nearest Neighbor.

  • Only one data field can be selected.
  • The available options are,
    • auto
    • Ball Tree
    • KD Tree
    • Brute Force
  • The default value is auto.
  • If auto is selected, the algorithm is selected automatically when the task is executed.

Leaf Size

 

It allows you to enter the number of leaf nodes.

  • Only numerical values can be entered.
  • The default value is 30.

Metric

It allows you to select the metric function used to define the distance between two points in a dataset.

  • Only one data field can be selected.
  • The available options are,
    • Minkowski
    • Cosine
    • Euclidean
    • Manhattan
  • The default value is Minkowski.

Contamination

It determines the proportion of the points with the highest LOF scores (points that are most isolated) to be predicted as anomalies.

  • It is an automatic hyperparameter tuning method.
  • The default value is auto.

Dimensionality Reduction

It allows you to select the dimensionality reduction technique.

Principal Component Analysis (PCA) maps the data linearly to a lower-dimensional space to maximize the variance of the data in the low-dimensional representation.

  • Only one data field can be selected.
  • The available options are,
    • None
    • PCA 
  • The default value is None.

Variance

It allows you to enter the variance value.

  • Only numerical values can be entered.
  • This data field is displayed only if the value of Dimensionality Reduction is selected as PCA.

Example of Local Outlier Factor

Consider a dataset Credit Card Balance with 13 features and 400 rows. A snippet of the input data is shown in the figure given below.











In the Properties pane of Local Outlier Factor, the values selected are given in the table below.

Property

Value

Dependent Variable

Married

Independent Variables

ID, Income, Limit, Rating, Cards, Age, Education, Balance

No. of Neighbors

20

Algorithm

auto

Leaf Size

30

Metric

Minkowski

Contamination

auto

Dimensionality Reduction

None

 The Result page of the Local Outlier Factor is shown in the figure given below.

The Result page initially displays the Cluster Plot based on the default combination of features in the X-axis and Y-axis data fields. To plot a Cluster Plot for different combinations of features, select the respective features from the X-axis and Y-axis drop-downs.

(info)
Note:

If you try to plot the Cluster Plot with the same features in the X-axis and Y-axis data fields, then Rubiscape gives an error.

 You can also view the Confusion Matrix based on the Event of Interest states of the selected dependent variable. Here, the dependent variable selected is Married, and its Event of Interest states are No and Yes.

To view the Confusion Matrix,

  1. Select either of the values from the Event of Interest drop-down.
  2. Click Evaluate, located in the top-right corner.

The Confusion Matrix is displayed on the right-hand side of the Result page.

The colored boxes in the Confusion Matrix represent the predicted values, while the white boxes represent the error values.

(info)
Notes:


  • Confusion Matrix can be evaluated only if the dependent variable values are displayed in the Event of Interest drop-down.
  • If Event of Interest displays N/A, the Confusion Matrix cannot be evaluated.
  • You are required to evaluate a Confusion Matrix based on the selected dependent variable only one time.

 The output Data page displays two more columns, Label and Index, along with the existing 13 features in the LOF result. A snippet of the output data of 15 columns, displayed on the Data page, is shown in the figure below.

(info)
Notes:

  • The rows in the Index column have values starting from 0 until 399.
  • The Label column has values 1 and -1, where 1 represents cluster data points, and -1 represents the number of outliers.
  • You can download the data from the Data page using the download icon (  ) located in the top-right.


    • Related Articles

    • Factor Analysis

      Factor Analysis is located under Model Studio ( ) in Data Preparation, in the left task pane. Use the drag-and-drop method to use the algorithm in the canvas. Click the algorithm to view and select different properties for analysis. Refer to ...
    • Factor Analysis

      Factor Analysis is located under Model Studio ( ) in Data Preparation, in the left task pane. Use the drag-and-drop method to use the algorithm in the canvas. Click the algorithm to view and select different properties for analysis. Refer to ...
    • Outlier Detection

      Outlier Detection is located under Model Studio ( ) in Data Preparation, in the task pane on the left. Use drag-and-drop method to use algorithm in the canvas. Click the algorithm to view and select different properties for analysis. Refer to ...
    • Outlier Detection

      Outlier Detection is located under Model Studio ( ) in Data Preparation, in the task pane on the left. Use drag-and-drop method to use algorithm in the canvas. Click the algorithm to view and select different properties for analysis. Refer to ...
    • Outliers

      Note This feature is only applicable to the boxplot widget. An outlier is an observation point that is distant from other observations. Outliers can significantly impact the results of statistical analysis and can occur for various reasons, including ...