Issue
With reference to the question, during training I am getting multiple losses and accuracies. For example,
Epoch 1/100
1382/1382 [==============================] - 694s 502ms/step - loss: 0.6798 - decoder_loss: 0.3399 - decoder_accuracy: 0.5770 - decoder_accuracy_1: 0.5770 - val_loss: 0.6606 - val_decoder_loss: 0.3373 - val_decoder_accuracy: 0.5783 - val_decoder_accuracy_1: 0.5783
It's hard to understand and what I want is only loss, accuracy, validation_loss and validation_accuracy. Is there any way to merge them.
Another thing is my log file is getting bigger and bigger as the network print the loss/accuracy after each step as:
1/1382 [..............................] - ETA: 13:59 - loss: 0.7226 - decoder_loss: 0.3613 - decoder_accuracy: 0.5536 - decoder_accuracy_1: 0.5536
2/1382 [..............................] - ETA: 10:23 - loss: 0.7204 - decoder_loss: 0.3602 - decoder_accuracy: 0.5881 - decoder_accuracy_1: 0.5881
3/1382 [..............................] - ETA: 8:57 - loss: 0.7151 - decoder_loss: 0.3576 - decoder_accuracy: 0.5821 - decoder_accuracy_1: 0.5821
Can I reduce it to output only when the epoch ends instead of each step?
Solution
i assume you use the fit funciton of keras with a verbose of 1. E.g.
model.fit(Xtrain, Ytrain, batch_size = 32, epochs = 100, verbose=1)
You can change the verbose to 2 then you will get only one output per epoch. Alternatively you can turn the training progress output off if you set verbose to 0. (Source: Keras API) E.g.
model.fit(Xtrain, Ytrain, batch_size = 32, epochs = 5, verbose=2)
Should give you an output like:
I hope this solves your problem. If not you might want to share a little bit of your code so we can help you futher.
EDIT1: As for your question if you can influence your monitoring metrics: Yes you can, but I can only answer your question with assumptions because I don't have your code. If you use keras for your model you should have used the "compile" funciton of keras somewhere. E.g
model.compile(optimizer=keras.optimizers.RMSprop(), # Optimizer
# Loss function to minimize
loss=keras.losses.SparseCategoricalCrossentropy(from_logits=True),
# List of metrics to monitor
metrics=["accuracy"])
You can influence the metrics which are shown in your console if you change the metrics values to the values you want to see. (Source:Kearas API,Keras Metrics)
If you only want to see the loss, accuracy
you can use the example above. The metrics val_...
will be generated accordingly if you use a validation _split or validation_datat
in your fit
function. E.g.
history = model.fit(x_train, y_train,
batch_size=64,
epochs=3,
# We pass some validation for
# monitoring validation loss and metrics
# at the end of each epoch
validation_data=(x_val, y_val))
If build you two examples to visualize my point
Example 1 shows accuracy, loss, val_acc
and val_loss
Example 2 shows
accuracy, loss,mae, val_acc, val_loss
and val_mae
For completness here the link to the colab notebook, where you can see my code:Colab for Examples
I hope this helps to solve your quesion completly. If not let me know.
Answered By - Fabian Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.