Anomalies

Anomaly detection is used to identify deviations or rare/suspicious events because they deviate from standard behaviors or patterns. These events are also called outliers and lie

Techniques for Anomaly Detection

  1. Statistical Methods: Statistical techniques like mean, standard deviation, and probability distributions to detect anomalies.
  2. Machine Learning Methods:
    1. Isolation Forest: Uses decision trees to isolate anomalies by recursively partitioning the data.
    2. Local Outlier Factor (LOF): Compares the local density of a point to its neighbors. Points with significantly lower density are considered anomalies.
    3. One-Class Support Vector Machine (SVM): A regular support vector machine algorithm tries to find a hyperplane that best separates the two classes of data points. In an SVM that has one class of data points, the task is to predict a hypersphere that separates the cluster of data points from the anomalies.

Practical Application of Anomaly Detection

Practice Problem

We have a list of scores for a test. An anomaly is defined as any score that is an outlier from the average score. Write a function to identify them and print them.

Instructions:

  1. Input: A list of integers representing scores.
  2. Output: Print each score that qualifies as an anomaly.
  3. Criteria: An anomaly is a score that differs from the average score by more than a specified threshold value.

Example:

Input: