Project

midas-edge

0.01
Low commit activity in last 3 years
A long-lived project that still receives updates
Edge stream anomaly detection for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 4.3.3
 Project Readme

MIDAS Ruby

MIDAS - edge stream anomaly detection - for Ruby

Build Status

Installation

Add this line to your application’s Gemfile:

gem "midas-edge"

Getting Started

Prep your data in the format [source, destination, time] (all integers) and sorted by time (ascending)

data = [
  [2, 3, 1],
  [3, 4, 2],
  [5, 9, 2],
  [2, 3, 3]
]

Get anomaly scores

midas = Midas.new
scores = midas.fit_predict(data)

Higher scores are more anomalous. There is not currently a defined threshold for anomalies.

Parameters

Pass parameters - default values below

Midas.new(
  rows: 2,           # number of hash functions
  buckets: 769,      # number of buckets
  alpha: 0.5,        # temporal decay factor
  threshold: nil,    # todo
  relations: true,   # whether to use MIDAS-R or MIDAS
  directed: true,    # treat the graph as directed or undirected
  seed: 0            # random seed
)

Data

Data can be an array of arrays

[[1, 2, 3], [4, 5, 6]]

Or a Numo array

Numo::NArray.cast([[1, 2, 3], [4, 5, 6]])

Performance

For large datasets, read data directly from files

midas.fit_predict("data.csv")

Resources

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone --recursive https://github.com/ankane/midas-ruby.git
cd midas-ruby
bundle install
bundle exec rake compile
bundle exec rake test