class_docstr: Keras callback for logging metrics and final model with MLflow.
  
  Metrics are logged after every epoch. The logger keeps track of the best model based on the
  validation metric. At the end of the training, the best model is logged with MLflow.
class_docstr_tok: ["Keras","callback","for","logging","metrics","and","final","model","with","MLflow",".","Metrics","are","logged","after","every","epoch",".","The","logger","keeps","track","of","the","best","model","based","on","the","validation","metric",".","At","the","end","of","the","training",",","the","best","model","is","logged","with","MLflow","."]
docstr: Log the best model with MLflow and evaluate it on the train and validation data so that the
  metrics stored with MLflow reflect the logged model.
docstr_tok: ["Log","the","best","model","with","MLflow","and","evaluate","it","on","the","train","and","validation","data","so","that","the","metrics","stored","with","MLflow","reflect","the","logged","model","."]
code: def on_train_end(self, *args, **kwargs):
      """
      Log the best model with MLflow and evaluate it on the train and validation data so that the
      metrics stored with MLflow reflect the logged model.
      """
      self._model.set_weights(self._best_weights)
      x, y = self._train
      train_res = self._model.evaluate(x=x, y=y)
      for name, value in zip(self._model.metrics_names, train_res):
          mlflow.log_metric(f"train_{name}", value)
      x, y = self._valid
      valid_res = self._model.evaluate(x=x, y=y)
      for name, value in zip(self._model.metrics_names, valid_res):
          mlflow.log_metric(f"valid_{name}", value)
      signature = infer_signature(x, y)
      log_model(
          keras_model=self._model,
          signature=signature,
          **self._pyfunc_params,
      )
  
imports: import math
  import os
  import tarfile
  import click
  import keras
  import numpy
  import tensorflow
  from image_pyfunc import decode_and_resize_image, log_model
  from keras.applications import vgg16
  from keras.callbacks import Callback
  from keras.layers import Dense, Flatten, Input, Lambda
  from keras.models import Model
  from keras.utils import np_utils
  from sklearn.model_selection import train_test_split
  import mlflow
  from mlflow.models import infer_signature
label_desc: Use image node_id 3 for calling the MLflowLogger obj's underlying member method code with example usage: obj.on_train_end() without return types