我对角星很陌生。我想知道是否有人能帮助我如何用我的数据( EEG )来喂养LSTM。我有来自306个频道的1400次试验,长度为600分。
1-我想创建一个LSTM网络,在每个时间步骤t中,第一层接受所有通道的输入(所有EEG通道最初被输入到同一个LSTM层)。
另外,另一个网络由几个306个LSTM组成,每个LSTM在第一层只连接到一个输入信道,第二编码层然后通过接收所有信道LSTM的级联输出矢量作为输入来执行信道间分析。
谢谢
发布于 2017-05-20 03:55:52
如果我正确理解了它,代码应该如下所示:
def lstm_model():
hidden_units = 512 # may increase/decrease depending on capacity needed
timesteps = 600
input_dim = 306
num_classes = 10 # num of classes for ecg output
model = Sequential()
model.add(LSTM(hidden_units, input_shape=(timesteps, input_dim)))
model.add(Dense(num_classes))
adam = Adam(lr=0.001)
model.compile(loss='categorical_crossentropy', optimizer=adam, metrics=['accuracy'])
return model
def train():
xt = np.array([]) # input_data shape = (num_trials, timesteps, input_dim)
yt = np.array([]) # out_data shape = (num_trials, num_classes)
batch_size = 16
epochs = 10
model = lstm_model()
model.fit(xt, yt, epochs=epochs, batch_size=batch_size, shuffle=True)https://stackoverflow.com/questions/44076942
复制相似问题