Reputation: 1215
I am using tensorflow V2.2 and run into TyepError when I do model.evaluate. Can someone advise what the issues may be? A screenshot of the execution and error message is shown below.
Upvotes: 7
Views: 8752
Reputation: 1464
Thanks Marco. In my version of Tensorflow (2.16.2), the metrics param needs to be a list:
model.compile(
loss = tf.keras.losses.BinaryCrossentropy(),
optimizer = tf.keras.optimizers.Adam(learning_rate=0.01),
metrics=['accuracy'])
Upvotes: 0
Reputation: 556
Actually, if you don't have metric='accuracy'
in the model.compile
, don't try to extract it in model.evaluate
.
So, you can change:
loss, acc= model.evaluate(df, df_y, verbose=0)
to
loss = model.evaluate(df, df_y, verbose=0)
Upvotes: 5
Reputation: 22031
you need to define a metric when you compile the model model.compile('adam', 'binary_crossentropy', metrics='accuracy')
in this way during evaluation, loss and accuracy are returned
Upvotes: 12