Giter Club home page Giter Club logo

robust-random-cut-forest's Introduction

Robust Random Cut Forests

This repo contains an implementation of the Robust Random Cut Forest anomaly detection model. This model attempts to find "anomalies" by seeking out points whose structure is not consistent with the rest of the data set. The random_cut_forest folder contains the RandomCutForest algorithm while the notebooks folder contains ipython notebooks showing examples leveraging the module.

Contributing

If you want to contribute to this repo simply submit a pull request!

Getting Started

Installation

To install the package you can do any of the following:

  • Run the command pip install ...

Using RobustRandomCutForests

Using a RobustRandomCutForest to classify potential anomalies in your data is simple. Assuming you already have a vector of data stored in X you would run the following:

from robust_random_cut_forest import robust_random_cut_forest
forest = robust_random_cut_forest.RobustRandomCutForest()
forest = forest.fit(X)

From there you can choose to get the normalized depths of each point within the forest by calling average_depths or have the forest label potential anomalies by calling predict:

depths = forest.decision_function(X)
labels = forest.predict(X)

The function decision_function will return an array with numbers ranging from zero to one. The lower the number the more anomalous the point appears (this is how sklearn implements scoring). By default any points that are given a score of 0.3 are labelled as anomalies. To stream new points into your forest simply call the add_point method:

# Given an array of points....
for point in points:
    forest.add_point(point)
depths = forest.decision_function(points)
labels = forest.predict(points)

Testing

All tests are written using pytest. Simply pip install pytest to be able to run tests. All tests are located under the tests folder. Any new tests are always welcome!

Articles

  • For more information on Robust Random Cut Forests, see Guha et al.'s 2016 paper which can be located here.
  • The original isolation forest paper can be found here.
  • Isolation Forests have been implemented in sklearn

Contact

[email protected]

robust-random-cut-forest's People

Contributors

navdeep-g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

domnicamalan

robust-random-cut-forest's Issues

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.