본문 바로가기
TensorFlow(AI)

What values are returned from model.evaluate() in Keras?

by swconsulting swconsulting 2018. 12. 19.

Returns

Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute model.metrics_names will give you the display labels for the scalar outputs.

Therefore, you can use metric_names property of your model to find out what each of those values corresponds to. For example:

from keras import layers
from keras import models
import numpy as np

input_data = layers.Input(shape=(100,)) 
out_1 = layers.Dense(1)(input_data)
out_2 = layers.Dense(1)(input_data)

model = models.Model(input_data, [out_1, out_2])
model.compile(loss='mse', optimizer='adam', metrics=['mae'])

print(model.metrics_names)

outputs the following:

['loss', 'dense_1_loss', 'dense_2_loss', 'dense_1_mean_absolute_error', 'dense_2_mean_absolute_error']

sources : 

댓글0