All Projects → ankane → Trend

ankane / Trend

Licence: mit
Anomaly detection and forecasting for Ruby

Programming Languages

ruby
36898 projects - #4 most used programming language

Trend

Ruby client for Trend, the anomaly detection and forecasting API

Build Status

Installation

Add this line to your application’s Gemfile:

gem 'trend'

For the self-hosted API, create an initializer with:

Trend.url = "http://localhost:8000"

Anomaly Detection

Detect anomalies in a time series

# generate series
series = {}
date = Date.parse("2018-04-01")
28.times do
  series[date] = rand(100)
  date += 1
end

# add an anomaly on Apr 21
series[date - 8] = 999

Trend.anomalies(series)

Works great with Groupdate

series = User.group_by_day(:created_at).count
Trend.anomalies(series)

Forecasting

Get future predictions for a time series

series = {}
date = Date.parse("2018-04-01")
28.times do
  series[date] = date.wday
  date += 1
end

Trend.forecast(series)

Also works great with Groupdate

series = User.group_by_day(:created_at).count
Trend.forecast(series)

Specify the number of predictions to return

Trend.forecast(series, count: 3)

Correlation [experimental]

Get the correlation between two time series

Trend.correlation(series, series2)

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 and testing:

git clone https://github.com/ankane/trend.git
cd trend
bundle install
rake test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].