Reputation: 1
A search for the best parameters for a model (namely U-Net) for multiclassification was performed and when compiling the model within the so-called 'model_builder' function two metrics were included: categorical accuracy and f1. However when reloading the models after the search using keras tuner the output of using model.metrics or model.evaluate is: ['loss', 'compile_metrics']. It shows neither accuracy nor f1.
Does anyone know what it could be?
---Piece of code---
Model builder:
METRICS = [ keras.metrics.CategoricalAccuracy(name='accuracy'), f1_weighted ]
# Tune the learning rate for the optimizer
# Choose an optimal value from 0.01, 0.001, or 0.0001
hp_learning_rate = hp.Choice('learning_rate', values=[1e-2, 1e-3])
optimizer = keras.optimizers.Adam(learning_rate=hp_learning_rate)
loss = tf.keras.losses.CategoricalFocalCrossentropy()
model.compile(loss=loss,
optimizer=optimizer,
metrics=METRICS,
jit_compile=False)
return model
Output:
model = model_builder(best_hps[0])
model.metrics_names
Upvotes: 0
Views: 97