TheDatumOrg / TSB-UAD

An End-to-End Benchmark Suite for Univariate Time-Series Anomaly Detection
https://tsb-uad.readthedocs.io/en/latest/
MIT License
147 stars 53 forks source link

benchmark error & install_requires version #2

Closed IceyBlackTea closed 1 year ago

IceyBlackTea commented 1 year ago

Hi, I tried to run the benchmark of yahoo a1 real data with lstm. I wrote the code based on your example.

results = tsb_uad(data, label, 'LSTM', metric='all')

Then, an error came out,

No module named 'TSB_UAD.vus.affiliation'

I think maybe you need to add __init__.py in TSB_UAD/vus/affiliation.

In addition, versions of requires in setup.py and requirements.txt are quiet different. For now, I deleted install_requires in setup.py. Some of these versions are very old, can you tell me how to modify them better?

IceyBlackTea commented 1 year ago

Also, when I run lstm, I found that there are some data that would raise errors, such as yahoo a1 real16.

File "***/TSB_UAD/models/lstm.py", line 33, in fit
    X_train = X_train.reshape((X_train.shape[0], X_train.shape[1], 1))
IndexError: tuple index out of range

I think the find_length function in slidingWindows.py is the reason, the window is too large, len(data_train) = 146 but slidingwindows = 167, and then X_train = [].

How should I modify the code better?

johnpaparrizos commented 1 year ago

Hello,

Thanks for reporting these issues - we are having a look and will get back to you.

Best, John

bogireddytejareddy commented 1 year ago

Hello,

I have tried to replicate your issue on my side. However, I couldn't. I was able to install and run (LSTM with Yahoo dataset) without any issues on a new environment. Can you provide the steps you used and the example code that is causing the issue? Thanks.

IceyBlackTea commented 1 year ago

Sorry, I've been updating my own project for a while, so I don't have the code with the original error.

I remember I followed the readme.md to install it.

conda env create --file environment.yml
conda activate TSB

pip install -r requirements.txt

pip install .

The python code should be similar to this,

import pandas as pd
from TSB_UAD.core import tsb_uad

for i in range(67):
    df = pd.read_csv(f'data/benchmark/YAHOO/Yahoo_A1real_{i+1}_data.out',header=None).to_numpy()
    data = df[:, 0].astype(float)
    label = df[:, 1]
    results = tsb_uad(data, label, 'LSTM', metric='all')

I run it on ubuntu 20.04 and the dataset is downloaded from the public link in readme.md.

I also use other dependencies in my project, with new versions in some packages, so I wrote this issue about setup.py & requirements.txt at first.

I modified some parameters in my own scenario, such as specifying the size of train data and window size, so there is no special problem in running my code now.

Thanks.