Resource-Efficient Supervised Anomaly Detection Classifier

version 1.0 — May 18, 2021

Contributors 2
View All

Release Date: May 10, 2021

Summary

Resource-Efficient Supervised Anomaly Detection Classifier is a scikit-learn classifier for resource-efficient anomaly detection that augments either Random-Forest or XGBoost classifiers to perform well in a resource-constrained setting. To that end, Resource-Efficient Supervised Anomaly Detection Classifier offers reduced memory footprint and computation as compared to Random-Forest and XGBoost.

The key idea behind Resource-Efficient Supervised Anomaly Detection Classifier is first to train a small model that is sufficient to correctly classify the majority of the queries. Then, using only subsets of the training data, train expert models for these fewer harder cases where the small model is at high risk of making a classification mistake.

Requirements

Prerequisites:

  • CMake 3.13 or higher
  • numpy
  • pandas
  • sklearn
  • xgboost
Instructions

Prerequisities installation:

- Install CMake 3.13 or higher.

- The python packages can be installed manually or by running:

   pip3 install -r requirments.txt

 

Usage:

- This classifier is implemented as a sci-kit classifier.

- example_program.py contains an example that compares RADE to Random Forest and XGBoost.

- Another example code for using RADE is: 

    from rade_classifier import RadeClassifier

    from sklearn.datasets import make_classification

    from sklearn.metrics import classification_report

    from sklearn.model_selection import train_test_split



    X, y = make_classification(n_samples=1000000, n_features=4,

                                n_informative=2, n_redundant=0,

                                random_state=0, shuffle=False, weights=[0.99, 0.01])



    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, stratify=y, random_state=42)



    clf = RadeClassifier()



    clf.fit(X_train, y_train)

    y_predicted = clf.predict(X_test)

    print(classification_report(y_test, y_predicted, digits=5))

Similar Flings
No similar flings found. Check these out instead...
View More