DurandalLee/ACEFormer

A function in myemd.py is missing...

Opened this issue · 4 comments

Thanks for sharing this repo, and I can't run the code without a function named snr in myemd.py.
Please check

qt@qt-desktop:~/Projects/ACEFormer$ python ACEFormer.py cuda:0 5 ./result ./data/SPY500.csv 1 2000
args :  ['ACEFormer.py', 'cuda:0', '5', './result', './data/SPY500.csv', '1', '2000']
script name :  ACEFormer.py
Start experiment index : 1 ......
Traceback (most recent call last):
  File "/home/qt/Projects/ACEFormer/ACEFormer.py", line 255, in <module>
    run_model(source_data, model_i, dev, back_num, itera_num, result_path) 
  File "/home/qt/Projects/ACEFormer/ACEFormer.py", line 184, in run_model
    data_set = AllData(source_data=source_data, verify_size=50, test_size=100, unit_size=30, predict_size=5, emd_col=emd_col, result_col=result_col, back_num=backtest_num, data_type=EmdData)
  File "/home/qt/Projects/ACEFormer/ACEFormer.py", line 28, in __init__
    self.former_train_set.append(data_type(train_tmp, unit_size, predict_size, emd_col=emd_col, result_col=result_col, emd_type=emd_type))
  File "/home/qt/Projects/ACEFormer/moduledata.py", line 107, in __init__
    input_emd = EMD_dealt(input_data[:, :-predict_size], emd_type)
  File "/home/qt/Projects/ACEFormer/moduledata.py", line 48, in __init__
    _exemd_data = _data.copy() + noise_list[2*i] * myemd.snr(_data, noise_list[2*i])
AttributeError: module 'myemd' has no attribute 'snr'

It appears that this function is the pe_i and the pm_i part of the paper, so it should be the IMF of the ith gaussian noise + the data. It should be relatively easy to reconstruct this function given the information in the paper.

Will this work? And thats not the single problem with the repo. Be prepared.

Calculates Signal-to-Noise Ratio (SNR) between the original signal and the noise.
Args:
signal (array-like): The original signal.
noise (array-like): The noise extracted from the signal.
Returns:
float: The SNR value.

def snr(signal, noise):
signal_power = np.mean(signal ** 2)
noise_power = np.mean(noise ** 2)
# Avoid divide by zero
if noise_power == 0: return np.inf
snr = 10 * np.log10(signal_power / noise_power)
return snr

pdfour commented

I have the same problems, along as many others...i'm sorry but when you make available a script through an arxiv paper, you actually make sure it works properly; this is absolutely not the case! so many errors and undone code..

also i have issues with the class EmdData in moduledata.py, where the authors are trying to convert a date format into int (??? like wtf) at self.stamp = np.array(source_time).astype(int) (line 93), idk if anyone has this issue too..

There are lots of problems with the code, in the test function model returns not the variables which are expected, self.ExpandConv had to be fixed in ACEFormer class, not obvious what to be done with stamp variable, and so on. Had to get rid of multiprocessing to make it a bit more straightforward. At least training has started. We'll see what is to be done next