I have an existing model and would like to add additional metrics to it. The Keras metrics page says the metrics are added at compile time, but I would like to add them after loading (in part because model.load_model()
only seems to load the first metric, and because I have new metrics I would like to try on existing model first). Is that possible?
A metric is a function that is used to judge the performance of your model. Metric functions are similar to loss functions, except that the results from evaluating a metric are not used when training the model. Note that you may use any loss function as a metric.
The tensor y_true is the true data (or target, ground truth) you pass to the fit method. It's a conversion of the numpy array y_train into a tensor. The tensor y_pred is the data predicted (calculated, output) by your model.
You can compile a model as many times as you want. That will not change its weights.
So you can load the model and then compile it with metrics.
The only possible problem of recompiling the model is possibly resetting the optimizer state.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With