Skip to content

Repository files navigation

Breakout Ruby

🔥 BreakoutDetection for Ruby

Learn how it works

Build Status

Installation

Add this line to your application’s Gemfile:

gem"breakout-detection"

Getting Started

Detect breakouts in a time series

series={Date.parse("2026-01-01")=>100,Date.parse("2026-01-02")=>150,Date.parse("2026-01-03")=>136,# ...}Breakout.detect(series)

Works great with Groupdate

series=User.group_by_day(:created_at).countBreakout.detect(series)

Series can also be an array without times (the index is returned)

series=[100,150,136, ...]Breakout.detect(series)

Options

Pass options - default values below

Breakout.detect(series,min_size: 30,# minimum observations between breakoutsmethod: "multi",# multi or amoc (at most one change)degree: 1,# degree of the penalization polynomial (multi only)beta: 0.008,# penalization term (multi only)percent: nil,# minimum percent change in goodness of fit statistic (multi only)alpha: 2,# weight of the distance between observations (amoc only)exact: true# exact or approximate median (amoc only))

Plotting

Add Vega to your application’s Gemfile:

gem"vega"

And use:

Breakout.plot(series,breakouts)

Credits

This library uses the C++ code from the BreakoutDetection R package and is available under the same license.

References

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 https://github.com/ankane/breakout-ruby.git
cd breakout-ruby
bundle install
bundle exec rake compile
bundle exec rake test

About

Breakout detection for Ruby

Resources

Stars

47 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages