LSTM模型权重用于训练用于文本分类的数据



我使用Keras为文本分类建立了一个LSTM模型。现在我有新的数据需要训练。我没有附加到原始数据并重新训练模型,而是考虑使用模型权重来训练数据。即使权重用新数据进行训练。然而,无论i训练的体积如何,该模型都不能预测正确的分类(即使我给出相同的句子进行预测(。原因可能是什么?请帮帮我。

您是否使用以下内容来保存经过训练的模型?

model.save('model.h5')
model.save_weights('model_weights.h5')

下面要加载它吗?

from keras.models import load_model
model = load_model('model.h5') # Load the architecture
model = model.load_weights('model_weights.h5') # Set the weights
# train on new data
model.compile...
model.fit...

加载的模型与此处保存的模型完全相同。如果你这样做,那么数据中一定有不同的东西(与训练的数据相比(。

最新更新