Business intelligence made simple
Auto-detect period with AnomalyDetection.rb
Andrew Kane975217af2c4c
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex cf4b4d7a..bbc383fe 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -17,6 +17,9 @@ jobs:gemfile: gemfiles/rails60.gemfileenv:BUNDLE_GEMFILE: ${{ matrix.gemfile }}+ TEST_ANOMALY_DETECTION: true+ TEST_PROPHET: true+ TEST_TREND: truesteps:- uses: actions/checkout@v3- uses: ruby/setup-ruby@v1diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 930b6543..0875006a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,6 +1,7 @@## 3.0.0 (unreleased)- Switched to Mapbox GL for maps (this affects Mapbox billing)+- Support for AnomalyDetection.rb is no longer experimental- Dropped support for Ruby < 2.7 and Rails < 6- Dropped support for R anomaly detectiondiff --git a/lib/blazer/result.rb b/lib/blazer/result.rbindex c97e48c5..4bc9896f 100644--- a/lib/blazer/result.rb+++ b/lib/blazer/result.rb@@ -192,8 +192,7 @@ module Blazeranomalies = Trend.anomalies(Hash[series])anomalies.include?(series.last[0])when "anomaly_detection"- period = 7 # TODO determine period- anomalies = AnomalyDetection.detect(Hash[series], period: period)+ anomalies = AnomalyDetection.detect(series.to_h, period: :auto)anomalies.include?(series.last[0])elseraise "Unknown anomaly detector"