result of ClassicSeasonalDecomposition is all Nan
sangyx opened this issue · 0 comments
sangyx commented
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