GithubHelp home page GithubHelp logo

anoma-li's Introduction

Anoma-Li

Anomaly detection is a critical tool in identifying abnormal behavior in a data set because anomalies and outliers show that something unexpected has occurred.

Anoma-Li aims to give an end-to-end solution to perform anomaly detection, from creating the dataset to visualizing the anomalies. Choose from various types of anomaly detection algorithms to perform outlier detection, and visualize the anomalies in the form of graphs.

The anomaly detection methods that this package performs are:

  • K Means Classification
  • Isolation Forest
  • K-NN Classification
  • Mean Average Deviation

Getting Started

Dependencies

  • Python3
    • Numpy
    • Pandas
    • Matplotlib
    • Sklearn [For test dataset]

Running the code

  • Clone the repo to your local machine
  • Run main.py to see how all the algorithms perform on synthetic data with visualization

OR

  • Run each algorithm individually by:
    • IForest:
# Importing IForest
from iforest import *

# Make anomaly detection on a DataFrame
iforest_pred(n=100, cntm=0.05, subspace=256, df=None, seed=14)

# Doesn't return anything, adds a column to DataFrame called "IForest", 
# which contains binary values for anomalies [0-Normal point, 1-Anomaly]
    • K-means clustering
# Importing K-means
from kmeans import *

# Create instance of Kmeans class and pass parameters
obj = Kmeans(X, 5, 100)

# Calculate distances
obj.Calc_dic()

# Output the value of outliers
print(obj.get_cluster_data(data))

#Output the value of anomalies
print(obj.get_outliers(data))

#Plots the WCSS graph
obj.WCSS_graph()
    • K-Nearest Neighbors
# Importing KNN
from knn import *

# Create KNN object
knn = KNN(k, xtrain, ytrain, xtest)

# Get anomalies
anomalies = knn.detect_anomaly(df, threshold)
    • Mean Absolute Deviation
# Importing MAD
from mad import *

# Checking anomaly possibility
anm = mad(df[n])

# If returned value is greater than 3, feature might contain anomalies

Future Scope

  • Unified Visualization function - have a single function to visualize anomalies from all algorithms

  • Roboust input validation - have a more robust validation of input DataFrames to test if an algorithm is compatible with it.

  • Addition of new anomaly detection algorithms - like Median Absolute Deviation and PCA.

Authors

Contributors name and contact info

Varadh Kaushik

Shrey Desai

Rohit Nair

Chris Bolsinger

anoma-li's People

Contributors

ronair212 avatar shreyvdesai avatar varadhkaushik avatar chrisbolsinger3 avatar

Stargazers

Tanuj Verma avatar Harsh Agrawal avatar  avatar  avatar

Watchers

 avatar

Forkers

ronair212

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.