Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library is not working as expected #24

Open
guillerial opened this issue Dec 20, 2018 · 0 comments
Open

Library is not working as expected #24

guillerial opened this issue Dec 20, 2018 · 0 comments
Labels

Comments

@guillerial
Copy link

Hello, I'm trying to test this library to a simple sinusoidal signal with some anomalies, but it's not working as I expected.

This is the sinusoidal:
image

And this is the script:

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import random
from anomaly_detection import anomaly_detect_ts
from datetime import datetime, timedelta

def datetime_range(start, end, delta):
    current = start
    while current < end:
        yield current
        current += delta

# Creating the base signal
Fs = 8000
f = 5
sample = 8000
now = datetime.now()
dts = [now + timedelta(hours=index) for index in range(sample)]
x = np.arange(sample)
y = np.sin(2 * np.pi * f * x / Fs)

# Now lets add some anomalies
for x in range(7200, 7270):
    y[x] = random.random()

# We call the library for detecting the anoms
pandas_dataframe = pd.Series(data=y, index=dts, dtype=None)
anoms = anomaly_detect_ts(pandas_dataframe,
                          max_anoms=0.1,
                          direction="both")

print(anoms)

plt.plot(dts, y)
plt.xlabel('date')
plt.ylabel('voltage(V)')
plt.show()

Do you know why it's not working, @Marcnuth ?

@Marcnuth Marcnuth added the bug label Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants