Skip to content

Business intelligence made simple

Auto-detect period with AnomalyDetection.rb

Andrew Kane975217af2c4c
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index cf4b4d7a..bbc383fe 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -17,6 +17,9 @@ jobs:
gemfile: gemfiles/rails60.gemfile
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
+ TEST_ANOMALY_DETECTION: true
+ TEST_PROPHET: true
+ TEST_TREND: true
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 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 detection
diff --git a/lib/blazer/result.rb b/lib/blazer/result.rb
index c97e48c5..4bc9896f 100644
--- a/lib/blazer/result.rb
+++ b/lib/blazer/result.rb
@@ -192,8 +192,7 @@ module Blazer
anomalies = 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])
else
raise "Unknown anomaly detector"