model.fit()列印精度和损失

时间:2019-08-13 14:44:05

标签: python keras deep-learning tf.keras

我有modelose.fit()和verbose = 1

但是我的输出是针对每个批处理大小进行打印::

1920/323432 [..............................]-预计到达时间:19:21-损失:10.4622-acc :0.343-ETA:18:40-损失:10.5245-acc:0.339-ETA:18:32-损失:10.5452-acc:0.338-ETA:18:29-损失:10.5556-acc:0.337-ETA:18:30 -损失:10.2380-帐户:0.357-预计时间:18:31-损失:10.3999-帐户:0.347-预计时间:18:37-损失:10.4978-帐户:0.341-预计时间:18:40-损失:10.5089-帐户:0.340 -ETA:18:39-损失:10.3376-acc:0.351-ETA:18:52-损失:10.2878-acc:0.354-ETA:18:55-损失:10.3490-acc:0.350-ETA:18:55-损失:10.2650-acc:0.356-ETA:18:54-损失:10.2897-acc:0.354-ETA:18:55-损失:10.1864-acc:0.361-ETA:18:55-损失:10.1799-acc:0.3615


model_trained = final_model.fit([LSTM_train_X['left'], LSTM_train_X['right']], LSTM_train_y, batch_size=batch_size, epochs=epochs,
                            validation_data=([LSTM_valid_X['left'], LSTM_valid_X['right']], LSTM_valid_y), verbose=1)

我已经使用keras.add()合并了两个模型


merged_output = add([branch1.output,branch2.output]) 

我写的总代码::


branch1 = Sequential()

branch1.add(Embedding(len(embeddings), embedding_dim, weights=[embeddings], input_length=max_seq_length, trainable=False))
branch1.add(LSTM(hidden_layer_nodes))


branch2 = Sequential()
branch2.add(Embedding(len(embeddings), embedding_dim, weights=[embeddings], input_length=max_seq_length, trainable=False))

branch2.add(LSTM(hidden_layer_nodes))


merged_output = add([branch1.output,branch2.output]) 


model_combined = Sequential()

model_combined.add(Activation('relu'))

model_combined.add(Dense(256))

model_combined.add(Activation('relu'))

model_combined.add(Dense(1))

model_combined.add(Activation('softmax'))

final_model = Model([branch1.input, branch2.input], model_combined(merged_output))


final_model.compile(optimizer=optimizer,loss='binary_crossentropy' , metrics=['accuracy'])

model_trained = final_model.fit([LSTM_train_X['left'], LSTM_train_X['right']], LSTM_train_y, batch_size=batch_size, epochs=epochs,
                            validation_data=([LSTM_valid_X['left'], LSTM_valid_X['right']], LSTM_valid_y), verbose=1)

如何清除该问题?

谢谢:)

0 个答案:

没有答案