From e9f8daf4daded01f804aee648f3fe0e1e9acf31b Mon Sep 17 00:00:00 2001 From: Max Halford Date: Thu, 2 Nov 2023 17:37:53 +0100 Subject: [PATCH] fix tests --- .github/workflows/delete-caches.yml | 2 +- river/anomaly/sad.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/delete-caches.yml b/.github/workflows/delete-caches.yml index 96fc9f892e..e4bedb060b 100644 --- a/.github/workflows/delete-caches.yml +++ b/.github/workflows/delete-caches.yml @@ -7,7 +7,7 @@ on: jobs: my-job: name: Delete all caches - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Clear caches diff --git a/river/anomaly/sad.py b/river/anomaly/sad.py index ae691d9a16..6b5b52d429 100644 --- a/river/anomaly/sad.py +++ b/river/anomaly/sad.py @@ -35,27 +35,27 @@ class StandardAbsoluteDeviation(anomaly.base.SupervisedAnomalyDetector): Examples -------- - >>> import numpy as np + >>> import random >>> from river import anomaly + >>> from river import stats >>> from river import stream - >>> np.random.seed(42) + >>> rng = random.Random(42) - >>> X = np.random.randn(150) + >>> model = anomaly.StandardAbsoluteDeviation(sub_stat=stats.Mean()) - >>> model = anomaly.StandardAbsoluteDeviation(sub_stat="mean") - - >>> for x in X: - ... model = model.learn_one(None, x) + >>> for _ in range(150): + ... y = rng.gauss(0, 1) + ... model = model.learn_one(None, y) >>> model.score_one(None, 2) - 2.209735291993561 + 2.057... >>> model.score_one(None, 0) - 0.08736408615569183 + 0.084... >>> model.score_one(None, 1) - 1.1485496890746263 + 0.986... """