Machine learning 在LSTM网络(Keras)中向输入层应用辍学

Machine learning 在LSTM网络(Keras)中向输入层应用辍学,machine-learning,neural-network,keras,dropout,Machine Learning,Neural Network,Keras,Dropout,在Keras中,是否有可能对LSTM网络的输入层应用辍学 如果这是我的模型: model = Sequential() model.add(LSTM(10, input_shape=(look_back, input_length), return_sequences=False)) model.add(Dense(1)) 目标是实现以下效果: model = Sequential() model.add(Dropout(0.5)) model.add(LSTM(10, input_shape

在Keras中,是否有可能对LSTM网络的输入层应用辍学

如果这是我的模型:

model = Sequential()
model.add(LSTM(10, input_shape=(look_back, input_length), return_sequences=False))
model.add(Dense(1))
目标是实现以下效果:

model = Sequential()
model.add(Dropout(0.5))
model.add(LSTM(10, input_shape=(look_back, input_length), return_sequences=False))
model.add(Dense(1))
您可以使用,其中您的模型将编写为:

inputs = Input(shape=(input_shape), dtype='int32')
x = Dropout(0.5)(inputs)
x = LSTM(10,return_sequences=False)(x)
定义输出层,例如:

predictions = Dense(10, activation='softmax')(x)
然后构建模型:

model = Model(inputs=inputs, outputs=predictions)

你试过了吗?有错误吗?您只需将输入形状设置为退出层。