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

result of ClassicSeasonalDecomposition is all Nan #124

Open
sangyx opened this issue Mar 31, 2021 · 0 comments
Open

result of ClassicSeasonalDecomposition is all Nan #124

sangyx opened this issue Mar 31, 2021 · 0 comments

Comments

@sangyx
Copy link

sangyx commented Mar 31, 2021

Hi, I used ClassicSeasonalDecomposition for my own dataset, while the result was all Nan. Could you help me to figure it out?
My code is:

import pandas as pd
from adtk.detector import *
from adtk.transformer import *
from adtk.data import validate_series
from adtk.visualization import plot


def sd(file):
    key, _, _, idx = file.split("_")
    idx = int(idx[:-4])
    df = pd.read_csv(file, names=["val"])
    df["id"] = df.index
    df.index = pd.DatetimeIndex(
        pd.date_range(start="20000101", periods=len(df), freq="30T")
    )
    s_train = validate_series(df.iloc[:idx]["val"])
    s_test = validate_series(df.iloc[idx:]["val"])

    tsf = ClassicSeasonalDecomposition(trend=True)

    st_train = tsf.fit_transform(s_train).rename("Train: transformed")
    plot(pd.concat([s_train, st_train], axis=1), ts_markersize=1)
    st_test = tsf.transform(s_test).rename("Test: transformed")
    plot(pd.concat([s_test, st_test], axis=1), ts_markersize=1)

    print(st_train)
    print(st_test)


if __name__ == "__main__":
    sd("001_UCR_Anomaly_35000.txt")

The dataset I used is: 001_UCR_Anomaly_35000.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant