class_docstr: Multinomial Variational Autoencoders (Multi-VAE) for Collaborative Filtering implementation
  
  :Citation:
  
      Liang, Dawen, et al. "Variational autoencoders for collaborative filtering."
      Proceedings of the 2018 World Wide Web Conference. 2018.
      https://arxiv.org/pdf/1802.05814.pdf
docstr: Fit model with the train sets and validate on the validation set.
  
  Args:
      x_train (numpy.ndarray): the click matrix for the train set.
      x_valid (numpy.ndarray): the click matrix for the validation set.
      x_val_tr (numpy.ndarray): the click matrix for the validation set training part.
      x_val_te (numpy.ndarray): the click matrix for the validation set testing part.
      mapper (object): the mapper for converting click matrix to dataframe. It can be AffinityMatrix.
code: def fit(self, x_train, x_valid, x_val_tr, x_val_te, mapper):
      """Fit model with the train sets and validate on the validation set.
  
      Args:
          x_train (numpy.ndarray): the click matrix for the train set.
          x_valid (numpy.ndarray): the click matrix for the validation set.
          x_val_tr (numpy.ndarray): the click matrix for the validation set training part.
          x_val_te (numpy.ndarray): the click matrix for the validation set testing part.
          mapper (object): the mapper for converting click matrix to dataframe. It can be AffinityMatrix.
      """
      # initialise LossHistory used for saving loss of validation and train set per epoch
      history = LossHistory()
  
      # initialise Metrics  used for calculating NDCG@k per epoch
      # and saving the model weights with the highest NDCG@k value
      metrics = Metrics(
          model=self.model,
          val_tr=x_val_tr,
          val_te=x_val_te,
          mapper=mapper,
          k=self.k,
          save_path=self.save_path,
      )
  
      self.reduce_lr = ReduceLROnPlateau(
          monitor="val_loss", factor=0.2, patience=1, min_lr=0.0001
      )
  
      if self.annealing:
          # initialise AnnealingCallback for annealing process
          anneal = AnnealingCallback(
              self.beta, self.anneal_cap, self.total_anneal_steps
          )
  
          # fit model
          self.model.fit_generator(
              generator=self.nn_batch_generator(x_train),
              steps_per_epoch=self.number_of_batches,
              epochs=self.n_epochs,
              verbose=self.verbose,
              callbacks=[metrics, history, self.reduce_lr, anneal],
              validation_data=(x_valid, x_valid),
          )
  
          self.ls_beta = anneal.get_data()
  
      else:
          self.model.fit_generator(
              generator=self.nn_batch_generator(x_train),
              steps_per_epoch=self.number_of_batches,
              epochs=self.n_epochs,
              verbose=self.verbose,
              callbacks=[metrics, history, self.reduce_lr],
              validation_data=(x_valid, x_valid),
          )
  
      # save lists
      self.train_loss = history.losses
      self.val_loss = history.val_losses
      self.val_ndcg = metrics.get_data()
  
imports: import numpy
  import matplotlib.pyplot
  import seaborn
  from recommenders.evaluation.python_evaluation import ndcg_at_k
  import tensorflow
  from tensorflow.keras.layers import *
  from tensorflow.keras.models import Model
  from tensorflow.keras import backend
  from tensorflow.keras.callbacks import ReduceLROnPlateau, Callback
label_desc: Use image node_id 6 for calling the Mult_VAE obj's underlying member method code with example usage: obj.fit(x_train, x_valid, x_val_tr, x_val_te, mapper) without return types