FateMurphy / CEEMDAN_LSTM

CEEMDAN_LSTM is a Python project for decomposition-integration forecasting models based on EMD methods and LSTM.
MIT License
228 stars 42 forks source link

你好,请问一下,使用训练完的KERAS_MODEL参数做预测为什么会报如下错误?是操作方式有问题吗? #28

Open zhengdacheng opened 8 months ago

zhengdacheng commented 8 months ago

训练代码如下:

kr = cl.keras_predictor(PATH='./', NEXT_DAY=True) df_result = kr.hybrid_keras_predict(data, show=True, plot=True, save=True) print('-------------------------------df_result--------------------------------------') print(df_result)

预测代码如下:

KERAS_MODEL = { 'co-imf0': 'Hybrid_CEEMDAN_OVMD0_GRU_Next_day_Keras_Forecasting_of_co_imf0_model.h5', 'co-imf1': 'Hybrid_CEEMDAN_OVMD0_GRU_Next_day_Keras_Forecasting_of_co_imf1_model.h5', 'co-imf2': 'Hybrid_CEEMDAN_OVMD0_GRU_Next_day_Keras_Forecasting_of_co_imf2_model.h5', } kr = cl.keras_predictor(PATH='./', NEXT_DAY=True, KERAS_MODEL=KERAS_MODEL) df_result = kr.hybrid_keras_predict(data, show=True, plot=True, save=True) print('-------------------------------df_result--------------------------------------') print(df_result)

预测报错如下:

ValueError: Input 0 of layer "Hybrid_CEEMDAN_OVMD0_GRU_Next_day_Keras_Forecasting_of_co_imf0_model.h5" is incompatible with the layer: expected shape=(None, 30, 8), found shape=(None, 30, 7)

FateMurphy commented 8 months ago

操作没有问题,是vmd每次分解出的子序列可能会不一样导致的,建议是固定vmd的K值

zhengdacheng commented 8 months ago

操作没有问题,是vmd每次分解出的子序列可能会不一样导致的,建议是固定vmd的K值 好的,请问有直接的参数可以固定vmd K值吗?我貌似没看到

FateMurphy commented 8 months ago

1、目前有内置的参数VMD_PARAMS控制,但是外部无法输入。 2、可以设置REDECOM_LIST=None,这样能先跑出结果,不过Next-day的结果一般都不太好。

yangyouxi123456 commented 8 months ago

@zhengdacheng 请问保存模型训练参数,然后再运行训练好的模型代码是怎么写的,可以告诉我吗,我搞了好久总是报错,不太会。