Skip to content

Commit

Permalink
Main (#47)
Browse files Browse the repository at this point in the history
* Merge Anomaly Detector code into main (#43)

* update python version & add tests for different python versions

* update python version & add tests for different python versions (#14)

* update setup.py (#13)

* add uvad and test

* step1

* setp2

* update Readme.md

* add dockerfile ,move get_margins

* fix predict

* delete pyd

* build success

* add build.py but no .pyd file generated

* update setup.py

* fix some error

* add model folder

---------

Co-authored-by: Duan Juanyong <[email protected]>

* update gitignore

* remove r dependency (#16)

* remove r dependency

* replace rpy2 with rstl

* update

* add build and release workflow (#12)

* Bump gitpython from 3.1.40 to 3.1.41 in /anomaly-detector (#4)

Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.40 to 3.1.41.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](gitpython-developers/GitPython@3.1.40...3.1.41)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump jinja2 from 3.1.2 to 3.1.3 in /anomaly-detector (#6)

Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.2...3.1.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add build workflow

* add build workflow

* add build workflow

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* merge

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* test on different python version (#17)

* Bump gitpython from 3.1.40 to 3.1.41 in /anomaly-detector (#4)

Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.40 to 3.1.41.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](gitpython-developers/GitPython@3.1.40...3.1.41)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump jinja2 from 3.1.2 to 3.1.3 in /anomaly-detector (#6)

Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.2...3.1.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add build workflow

* add build workflow

* add build workflow

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* merge

* add more test cases

* delete some uvad test cases

* delete some uvad test cases

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add caching packages dependencies

* add cache dependencies to boost test

* add cache dependencies to boost test

* Update ci.yml

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update param check

* test mlflow on UnivariateAnomalyDetector, add new class (#18)

* add e2e_test for UnivariateAnomalyDetector

* add EntireAnomalyDetector, LatestAnomalyDetector

* rename

* update model output & usage

* update test, remove saving results

* update model output to avoid duplicated keys

* check insufficient predict data

* test output (#20)

* Bump gitpython from 3.1.40 to 3.1.41 in /anomaly-detector (#4)

Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.40 to 3.1.41.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](gitpython-developers/GitPython@3.1.40...3.1.41)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump jinja2 from 3.1.2 to 3.1.3 in /anomaly-detector (#6)

Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.2...3.1.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add build workflow

* add build workflow

* add build workflow

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* merge

* add more test cases

* delete some uvad test cases

* delete some uvad test cases

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add caching packages dependencies

* add cache dependencies to boost test

* add cache dependencies to boost test

* Update ci.yml

* test output

* test output

* test output

* add license to all .py file

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update numpy version to 1.26.x (#21)

* add e2e_test for UnivariateAnomalyDetector

* add EntireAnomalyDetector, LatestAnomalyDetector

* rename

* update numpy version to 1.26.x

* update Dockerfile & pandas version

* Update pyproject.toml

numpy>=1.23.5

* update ci.yml

* fix expectedValue error

* Update pipeline for pypi publish (#22)

* update gitignore

* update build pipeline to push to pypi

* Merge (#23)

* update gitignore

* update build pipeline to push to pypi

* install deps

* update pipeline (#24)

* update pipeline (#25)

* update pipeline (#26)

* update build option

* add wheel

* update pipeline

* add long description

* add long text description type

* change package name

* uploade src only

* update maintainer

* update build

* Bump mlflow from 2.9.2 to 2.10.0 in /anomaly-detector

Bumps [mlflow](https://github.com/mlflow/mlflow) from 2.9.2 to 2.10.0.
- [Release notes](https://github.com/mlflow/mlflow/releases)
- [Changelog](https://github.com/mlflow/mlflow/blob/master/CHANGELOG.md)
- [Commits](mlflow/mlflow@v2.9.2...v2.10.0)

---
updated-dependencies:
- dependency-name: mlflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* change package name

* update version

* Update README.md

* update pipeline

* update workflow file

* add sample notebook

* update workflow and ignore file

* add numpy for build

* change trigger condition

* release version v0.2.2 (#41)

* fix error in publish pipeline

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: shuawei <[email protected]>
Co-authored-by: luxiong-ms1 <[email protected]>
Co-authored-by: Zeke Xia <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jr-MS <[email protected]>
Co-authored-by: Zeke Xia <[email protected]>

* add release key

* remove unexpected value

* change release to gh release

* update pipeline

* debug

* debug

* debug path

* Merge Anomaly Detector code into main (#43)

* update python version & add tests for different python versions

* update python version & add tests for different python versions (#14)

* update setup.py (#13)

* add uvad and test

* step1

* setp2

* update Readme.md

* add dockerfile ,move get_margins

* fix predict

* delete pyd

* build success

* add build.py but no .pyd file generated

* update setup.py

* fix some error

* add model folder

---------

Co-authored-by: Duan Juanyong <[email protected]>

* update gitignore

* remove r dependency (#16)

* remove r dependency

* replace rpy2 with rstl

* update

* add build and release workflow (#12)

* Bump gitpython from 3.1.40 to 3.1.41 in /anomaly-detector (#4)

Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.40 to 3.1.41.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](gitpython-developers/GitPython@3.1.40...3.1.41)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump jinja2 from 3.1.2 to 3.1.3 in /anomaly-detector (#6)

Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.2...3.1.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add build workflow

* add build workflow

* add build workflow

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* merge

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* test on different python version (#17)

* Bump gitpython from 3.1.40 to 3.1.41 in /anomaly-detector (#4)

Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.40 to 3.1.41.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](gitpython-developers/GitPython@3.1.40...3.1.41)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump jinja2 from 3.1.2 to 3.1.3 in /anomaly-detector (#6)

Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.2...3.1.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add build workflow

* add build workflow

* add build workflow

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* merge

* add more test cases

* delete some uvad test cases

* delete some uvad test cases

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add caching packages dependencies

* add cache dependencies to boost test

* add cache dependencies to boost test

* Update ci.yml

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update param check

* test mlflow on UnivariateAnomalyDetector, add new class (#18)

* add e2e_test for UnivariateAnomalyDetector

* add EntireAnomalyDetector, LatestAnomalyDetector

* rename

* update model output & usage

* update test, remove saving results

* update model output to avoid duplicated keys

* check insufficient predict data

* test output (#20)

* Bump gitpython from 3.1.40 to 3.1.41 in /anomaly-detector (#4)

Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.40 to 3.1.41.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](gitpython-developers/GitPython@3.1.40...3.1.41)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump jinja2 from 3.1.2 to 3.1.3 in /anomaly-detector (#6)

Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.2...3.1.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add build workflow

* add build workflow

* add build workflow

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* test poetry install

* merge

* add more test cases

* delete some uvad test cases

* delete some uvad test cases

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add different python version

* add caching packages dependencies

* add cache dependencies to boost test

* add cache dependencies to boost test

* Update ci.yml

* test output

* test output

* test output

* add license to all .py file

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update numpy version to 1.26.x (#21)

* add e2e_test for UnivariateAnomalyDetector

* add EntireAnomalyDetector, LatestAnomalyDetector

* rename

* update numpy version to 1.26.x

* update Dockerfile & pandas version

* Update pyproject.toml

numpy>=1.23.5

* update ci.yml

* fix expectedValue error

* Update pipeline for pypi publish (#22)

* update gitignore

* update build pipeline to push to pypi

* Merge (#23)

* update gitignore

* update build pipeline to push to pypi

* install deps

* update pipeline (#24)

* update pipeline (#25)

* update pipeline (#26)

* update build option

* add wheel

* update pipeline

* add long description

* add long text description type

* change package name

* uploade src only

* update maintainer

* update build

* Bump mlflow from 2.9.2 to 2.10.0 in /anomaly-detector

Bumps [mlflow](https://github.com/mlflow/mlflow) from 2.9.2 to 2.10.0.
- [Release notes](https://github.com/mlflow/mlflow/releases)
- [Changelog](https://github.com/mlflow/mlflow/blob/master/CHANGELOG.md)
- [Commits](mlflow/mlflow@v2.9.2...v2.10.0)

---
updated-dependencies:
- dependency-name: mlflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* change package name

* update version

* Update README.md

* update pipeline

* update workflow file

* add sample notebook

* update workflow and ignore file

* add numpy for build

* change trigger condition

* release version v0.2.2 (#41)

* fix error in publish pipeline

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: shuawei <[email protected]>
Co-authored-by: luxiong-ms1 <[email protected]>
Co-authored-by: Zeke Xia <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jr-MS <[email protected]>
Co-authored-by: Zeke Xia <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: shuawei <[email protected]>
Co-authored-by: luxiong-ms1 <[email protected]>
Co-authored-by: Zeke Xia <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jr-MS <[email protected]>
Co-authored-by: Zeke Xia <[email protected]>
  • Loading branch information
7 people authored May 31, 2024
1 parent 5cdc02e commit 18e152b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/anomaly_detector/univariate/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

# ---------------------------------------------------------
2 changes: 1 addition & 1 deletion src/anomaly_detector/univariate/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
from .helpers import *
from .stl_helpers import *
from .r_stl import stl, stl_adjust_trend
from .refine import *
from .refine import *
12 changes: 6 additions & 6 deletions src/anomaly_detector/univariate/util/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def leastsq(x, y):
return a, b


def average_filter(values, n=3, fill_to_n = False):
def average_filter(values, n=3, fill_to_n=False):
"""
Calculate the sliding window average for the give time series.
Mathematically, res[i] = sum_{j=i-t+1}^{i} values[j] / t, where t = min(n, i+1)
Expand All @@ -45,7 +45,7 @@ def average_filter(values, n=3, fill_to_n = False):
:return res: list.
a list of value after the average_filter process.
"""
fill_n=n
fill_n = n
if n >= len(values):
n = len(values)

Expand All @@ -55,7 +55,7 @@ def average_filter(values, n=3, fill_to_n = False):

for i in range(1, n):
if fill_to_n:
res[i] = (res[i] + ((res[i]-values[i]) / i) * (fill_n-i-1)) / fill_n
res[i] = (res[i] + ((res[i] - values[i]) / i) * (fill_n - i - 1)) / fill_n
else:
res[i] /= (i + 1)

Expand Down Expand Up @@ -106,7 +106,7 @@ def guess_trended_period(data):
broad = fit_trend(data, kind="median", period=max_period)
if np.any(~np.isfinite(broad)):
raise Exception(ValueOverflow)

peaks = periodogram_peaks(data - broad)
if peaks is None:
return max_period
Expand Down Expand Up @@ -259,14 +259,14 @@ def normalize(values, min_max=False):
def smooth_spikes(data):
std = data.std() + 1e-8
mean = data.mean()
anomaly_index = [] if std == 0 else np.where(np.abs(data-mean) / std >= 3)[0]
anomaly_index = [] if std == 0 else np.where(np.abs(data - mean) / std >= 3)[0]
series = pd.Series(data, copy=True)
series[anomaly_index] = np.nan
return series.interpolate(method='linear', limit_direction='both').values


def get_delta(delta, values):
d_values = [values[i] - values[i-1] for i in range(1, len(values))]
d_values = [values[i] - values[i - 1] for i in range(1, len(values))]
d_values = [d_values[delta]] * (delta + 1) + d_values[delta:]
return d_values

Expand Down

0 comments on commit 18e152b

Please sign in to comment.