mirror of
https://github.com/wassname/keras-language-modeling.git
synced 2026-09-09 11:25:29 +08:00
👍
This commit is contained in:
+1
-1
@@ -184,7 +184,7 @@ test_model.load_weights(os.path.join(models_path, 'iqa_model_for_prediction.h5')
|
||||
|
||||
# found through experimentation that ~24 epochs generalized the best
|
||||
print('Fitting model')
|
||||
for i in range(30):
|
||||
for i in range(10000):
|
||||
print('----- %d -----' % i)
|
||||
np.random.shuffle(ab_data)
|
||||
train_model.fit([q_data, ag_data, ab_data], targets, nb_epoch=1, batch_size=128, validation_data=[[qv_data, avg_data, avb_data], v_targets], shuffle=True)
|
||||
|
||||
@@ -82,7 +82,7 @@ def make_model(maxlen_question, maxlen_answer, n_words, n_lstm_dims=141, n_embed
|
||||
|
||||
# merge together
|
||||
# note: `cos` refers to "cosine similarity", i.e. similar vectors should go to 1
|
||||
# for training's sake, "abs" limits range to be tween 0 and 1 (binary classification)
|
||||
# for training's sake, "abs" limits range to between 0 and 1 (binary classification)
|
||||
good_out = merge([q_out, ag_out], name='good', mode='cos', dot_axes=1)
|
||||
bad_out = merge([q_out, ab_out], name='bad', mode='cos', dot_axes=1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user