ML4ITS / mtad-gat-pytorch

PyTorch implementation of MTAD-GAT (Multivariate Time-Series Anomaly Detection via Graph Attention Networks) by Zhao et. al (2020, https://arxiv.org/abs/2009.02040).
MIT License
328 stars 76 forks source link

Fix DataFrame Fragmentation warning & Fix wrong arguments parsing #25

Closed srigas closed 1 year ago

srigas commented 1 year ago

This proposed pull request solves two issues that come up when running the MTAD-GAT PyTorch model.

[1] During prediction, a series of PerformanceWarning messages spams the console. This is due to the fact that in the prediction.py file, an empty dataframe is initialized and is then populated with columns and values within a for loop. This is considered a bad practice, hence the warnings that spam the console. Initializing a dictionary object and then casting it into a DataFrame solves the problem.

[2] More importantly, during prediction, the wrong arguments are parsed in the predict.py file. More specifically, all model parameters are parsed from the args dictionary instead of the model_args dictionary. This means one of two things: either the user must specify all model parameters both during training and prediction through the console, or if they do not specify them during prediction, then an error does not occur if and only if the model has been trained with the default parameters. Replacing args with model_args in the specified region of the code solves this problem.

axeloh commented 1 year ago

Hi @srigas,

Thanks for your efforts on improving the project. We will review your PR soon.

Regards, Axel

wQvaale commented 1 year ago

Thanks @srigas! Your contribution is highly appreciated.

// Will