MIDAS Ruby

April 7, 2026 · View on GitHub

MIDAS - edge stream anomaly detection - for Ruby

Build Status

Installation

Add this line to your application’s Gemfile:

gem "midas-edge"

Getting Started

Create a detector

midas = Midas::Detector.new

Update with an event

score = midas.update(source_id, destination_id, time)

IDs should be integers and events should be ordered by time (ascending). Higher scores are more anomalous. There is not currently a defined threshold for anomalies.

Parameters

Pass parameters - default values below

Midas::Detector.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
  seed: 0            # random seed
)

Performance

For large datasets, read data directly from files

midas.batch_update("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