Erläuterung des Projektvideos: VMD-Attention-LSTM-Zeitreihenpreisvorhersage. Der tatsächliche vollständige Datencode kann direkt ausgeführt werden_bilibili_bilibili
Modelldiagramm:
Datenanzeige: Zehntausende Daten reichen aus
Hauptmodellcode:
import tensorflow as tf
def attention_3d_block(inputs,TIME_STEPS,SINGLE_ATTENTION_VECTOR):
# inputs.shape = (batch_size, time_steps, input_dim)
# inputs = tf.expand_dims(inputs,1)
input_dim = int(inputs.shape[2])
a = tf.keras.layers.Permute((2, 1))(inputs)
a = tf.keras.layers.Reshape((input_dim, TIME_STEPS))(a) # this line is not useful. It's just to kn