Search code examples
machine-learningkerasmetrics

Adding metrics to existing model in Keras


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?


Solution

  • 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.