class_docstr: Periodically saves the model during training. By default, it saves the
  model every epoch; increasing the ``epoch_interval`` will make
  checkpointing less frequent.
  
  If the given filename contains the ``{}`` string, the epoch number will be
  subtituted in, resulting in multiple checkpoint folders with different
  names. If a filename such as 'ivis-checkpoint' is provided, only the
  latest checkpoint will be kept.
  
  :param str log_dir: Folder to save resulting embeddings.
  :param str filename: Filename to save each file as. `{}` in string
      will be substituted with the epoch number.
  
  Example usage:
  ::
  
      from ivis.nn.callbacks import ModelCheckpoint
      from ivis import Ivis
  
      # Save only the latest checkpoint to current directory every 10 epochs
      checkpoint_callback = ModelCheckpoint(log_dir='.',
                                          filename='latest-checkpoint.ivis',
                                          epoch_interval=10)
  
      model = Ivis(callbacks=[checkpoint_callback])
class_docstr_tok: ["Periodically","saves","the","model","during","training",".","By","default",",","it","saves","the","model","every","epoch",";","increasing","the","``","epoch_interval","``","will","make","checkpointing","less","frequent",".","If","the","given","filename","contains","the","``","{","}","``","string",",","the","epoch","number","will","be","subtituted","in",",","resulting","in","multiple","checkpoint","folders","with","different","names",".","If","a","filename","such","as","'ivis-checkpoint","'","is","provided",",","only","the","latest","checkpoint","will","be","kept",".",":","param","str","log_dir",":","Folder","to","save","resulting","embeddings",".",":","param","str","filename",":","Filename","to","save","each","file","as",".","`","{","}","`","in","string","will","be","substituted","with","the","epoch","number",".","Example","usage",":",":",":","from","ivis.nn.callbacks","import","ModelCheckpoint","from","ivis","import","Ivis","#","Save","only","the","latest","checkpoint","to","current","directory","every","10","epochs","checkpoint_callback","=","ModelCheckpoint","(","log_dir=","'",".","'",",","filename='latest-checkpoint.ivis","'",",","epoch_interval=10",")","model","=","Ivis","(","callbacks=","[","checkpoint_callback","]",")"]
code: def __init__(
      self,
      log_dir="./model_checkpoints",
      filename="model-checkpoint_{}.ivis",
      epoch_interval=1,
  ):
      super(ModelCheckpoint, self).__init__()
      self.log_dir = log_dir
      os.makedirs(log_dir, exist_ok=True)
      self.filename = filename
      self.epoch_interval = epoch_interval
      self.epochs_since_last_save = 0
      self.ivis_model = None
  
imports: import io
  import os
  import numpy
  import tensorflow
  from tensorflow.keras.callbacks import Callback
  from sklearn.preprocessing import MinMaxScaler
label_desc: Use image node_id 1 to create a new ModelCheckpoint object from inherited base classes: Callback with example: obj = ModelCheckpoint(log_dir, filename, epoch_interval)