Keras 常见问题汇集

How can I save a Keras model? 如何保存模型?

How can I visualize the output of an intermediate layer?  如何可视化中间层的输入?

How can I use Keras with datasets that don’t fit in memory?  内存不能加载数据集怎么办?

How can I interrupt training when the validation loss isn’t decreasing anymore?  损失值不再下降的时候,如何停止训练

How is the validation split computed?  验证集是如何分割计算的?

Is the data shuffled during training? 在训练时数据是否随机打乱

How to share weights of word embeddings? [graph] [seqence] [Siamese][Siamese讨论]如何共享词向量权重
s1 = Sequential()
s2 = Sequential()

#add shared layers
add_shared_layer(Embedding(…), [s1, s2])
add_shared_layer(LSTM(…), [s1, s2])
add_shared_layer(Dense(…), [s1, s2])

#everything else as usual
model = Sequential()
model.add(Merge([s1,s2], ‘dot’))
model.add(Dense(1))
model.add(Activation(‘sigmoid’))

但实际上面的代码有问题,因为词向量只能做第一个Layer,而add_shared_layer又不能处理第一层Layer,因而需要加入一些脚本代码,见[https://github.com/fchollet/keras/issues/1409]

参考:http://blog.csdn.net/u014114990/article/details/49766201

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>