Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
System for anomaly detection in mass generic data
Clojure
Branch: clojure

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src/stewie
test/stewie/test
.gitignore
LICENSE
Procfile
README
epl-v10.html
project.clj

README

# Stewie

Stewie is an unsupervised anomaly detector written in Clojure.

Given a multivariate unlabeled input stream, Stewie detects anomalies using
statistical analysis of the input data, assuming that anomalies are rare and
that all metrics are uncorrelated and normal distributed.

The detector returns the probability density of each new point in constant time
and with constant memory requirement.

## Installation

First, install leiningen (https://github.com/technomancy/leiningen/)

Git clone the project:

    $ git clone https://github.com/globocom/stewie

Install the dependencies:

    $ cd stewie-clojure
    $ lein deps

## Usage

In the REPL, use stewie.core namespace, and feed it with maps:

    => (use 'stewie.core)
    nil
    => (def det (detector))
    #'stewie.app/det
    => (det {:x 40 :y 20})
    NaN
    => (det {:x 30 :y 20.4})
    0.05854983152431939

The return value means that the probability density at `{:x 30 :y 20.4}` is `0.0585`.


## Web Application

We can also run the detector as a web application

    $ lein run

To use, just post the data to the root URL.

    $ curl localhost:8080/bucket
    {"token":"6adf44ffd853f8131d41b20572265aa12c4227e6"}
    $ curl localhost:8080/bucket --data "x=3&y=5&token=6adf44ffd853f8131d41b20572265aa12c4227e6"
    {"data":{"y":5,"x":3},"density":"NaN"}
    $ curl localhost:8080/bucket --data "x=7&y=20&token=6adf44ffd853f8131d41b20572265aa12c4227e6"
    {"data":{"y":20,"x":7},"density":0.0039033221016212777}
    $ curl localhost:8080/bucket --data "x=3.0&y=3.14&token=6adf44ffd853f8131d41b20572265aa12c4227e6"
    {"data":{"y":3.14,"x":3.0},"density":0.006188085315908742}


## Test

We use midje for testing. Simply run

    $ lein midje


## Deploy to Heroku

    $ heroku create --stack cedar
    $ git push heroku master
    $ heroku scale web=1
    $ heroku addons:add mongohq:free
    $ curl http://stewie.herokuapp.com
    Welcome to Stewie!

## License

Copyright (C) 2012 Globo.com

Distributed under the Eclipse Public License, the same as Clojure.
Something went wrong with that request. Please try again.