class_docstr: AEEmbedding is an implementation of BaseEmbedding. AEEmbedding implements
  encoder-decoder architecture. This implementation is used by the NNContrastive
  explainer, to derive low-dimensional vector embedding in an unsupervised fashion.
class_docstr_tok: ["AEEmbedding","is","an","implementation","of","BaseEmbedding",".","AEEmbedding","implements","encoder-decoder","architecture",".","This","implementation","is","used","by","the","NNContrastive","explainer",",","to","derive","low-dimensional","vector","embedding","in","an","unsupervised","fashion","."]
code: def fit(
      self,
      x: Union[pd.DataFrame, np.ndarray],
      y: Any = None,
      epochs: int = 5,
      batch_size: int = 512,
      shuffle: bool = True,
      validation_fraction: float = 0.1,
      verbose: int = 1,
      random_seed: int = None,
  ):
      try:
          import tensorflow as tf
      except ImportError:
          raise RuntimeError(
              f"Error: can not import tensorflow library!"
          )
  
      tf.random.set_seed(random_seed)
      x = self.preprocess(x, fit=True)
      input_shape = x.shape[-1]
      self.build(input_shape=input_shape)
  
      x_inp = tf.keras.layers.Input(
          input_shape,
      )
      model = tf.keras.Model(
          inputs=x_inp, outputs=[self._decoder(self._encoder(x_inp))]
      )
      model.compile(loss="mean_squared_error", optimizer="adam")
  
      n = x.shape[0]
      x_train = x
      validation_data = None
  
      if n < self._max_train_records:
          if n * validation_fraction > 10:
              n = int(n * (1.0 - validation_fraction))
              x_train, x_val = x[:n], x[n:]
              validation_data = (x_val, x_val)
          history = model.fit(
              x_train,
              x_train,
              validation_data=validation_data,
              batch_size=batch_size,
              shuffle=shuffle,
              epochs=epochs,
              verbose=verbose,
          )
      else:
          from .utils import AESampler
  
          sampler = AESampler(
              x_train,
              batch_size=batch_size,
              max_size=self._max_train_records,
          )
          history = model.fit(sampler, epochs=epochs, verbose=verbose)
  
      self._fitted = True
      return history
  
imports: import numpy
  import pandas
  from abc import ABC, abstractmethod
  from typing import Union, List, Any
  from sklearn.preprocessing import OneHotEncoder, OrdinalEncoder, QuantileTransformer, StandardScaler, MinMaxScaler
label_desc: Use image node_id 4 for calling the AEEmbedding obj's underlying member method code with example usage: obj.fit(x, y, epochs, batch_size, shuffle, validation_fraction, verbose, random_seed) and returns: history