microsoft / StemGNN

Spectral Temporal Graph Neural Network (StemGNN in short) for Multivariate Time-series Forecasting
515 stars 117 forks source link

Error of "unsupported operand type(s) for -: 'list' and 'list'" #22

Open tdingquan opened 2 years ago

tdingquan commented 2 years ago

When using min-max method on ECG data, we will encounter error of "unsupported operand type(s) for -: 'list' and 'list'".

Line 10, forecast_dataloader.py

Fadegentle commented 2 years ago

Maybe the coder forgot to turn the list into numpy.ndarray, because he just use the z_score with data = (data - mean) / std. The data is numpy.ndarray, so it actually turns into - operand of numpy.ndarray.

So you can try scale = np.array(norm_statistic['max']) - norm_statistic['min'] + 1e-5 instead of scale = norm_statistic['max'] - norm_statistic['min'] + 1e-5

This is a useful trick.

tdingquan commented 2 years ago

Correct. I chose to turn the list into numpy.array before the - operation.