class_docstr: Trains an autoencoder (AE) to represent categorical information with over 100 categories. This is used to ensure that feature vectors for categorical data with many categories are not excessively large.
  
  The AE defaults to a vector sized 100 but can be adjusted to user preference. It is highly advised NOT to use this encoder to feature engineer your target, as reconstruction accuracy will determine your AE's ability to decode properly.
docstr: Creates inputs and prepares a categorical autoencoder (CatAE) for input data. Currently, does not support a dev set; inputs for train and dev are concatenated together to train an autoencoder.
  
  :param train_priming_data: Input training data
  :param dev_priming_data: Input dev data (Not supported currently)
docstr_tok: ["Creates","inputs","and","prepares","a","categorical","autoencoder","(","CatAE",")","for","input","data",".","Currently",",","does","not","support","a","dev","set",";","inputs","for","train","and","dev","are","concatenated","together","to","train","an","autoencoder",".",":","param","train_priming_data",":","Input","training","data",":","param","dev_priming_data",":","Input","dev","data","(","Not","supported","currently",")"]
code: def prepare(
      self, train_priming_data: pd.Series, dev_priming_data: pd.Series
  ):
      """
      Creates inputs and prepares a categorical autoencoder (CatAE) for input data. Currently, does not support a dev set; inputs for train and dev are concatenated together to train an autoencoder.
  
      :param train_priming_data: Input training data
      :param dev_priming_data: Input dev data (Not supported currently)
      """  # noqa
  
      if self.is_prepared:
          raise Exception(
              'You can only call "prepare" once for a given encoder.'
          )
  
      if self.is_target:
          log.warning(
              "You are trying to use an autoencoder for the target value! This is very likely a bad idea."
          )
  
      error_msg = f"Provided an invalid input encoder ({self.input_encoder}), please use either `OneHotEncoder` or `SimpleLabelEncoder`."  # noqa
      if self.input_encoder is not None:
          assert self.input_encoder in (
              "OneHotEncoder",
              "SimpleLabelEncoder",
          ), error_msg
  
      log.info("Preparing a categorical autoencoder.")
  
      if self.input_encoder == "SimpleLabelEncoder" or (
          self.input_encoder is None
          and train_priming_data.nunique() > 500
      ):
          log.info(
              "Deploying SimpleLabelEncoder for CategoricalAutoEncoder input."
          )
          self.input_encoder = SimpleLabelEncoder(
              is_target=self.is_target
          )
          input_len = self.input_encoder.output_size
          self.output_size = 32
          net_shape = [input_len, 128, 64, self.output_size, input_len]
      else:
          log.info(
              "Deploying OneHotEncoder for CategoricalAutoEncoder input."
          )
          self.input_encoder = OneHotEncoder(is_target=self.is_target)
          net_shape = None  # defined at prepare() due to the OHE output size being determined then
  
      train_loader, dev_loader = self._prepare_AE_input(
          train_priming_data, dev_priming_data
      )
  
      best_model = self._prepare_catae(
          train_loader, dev_loader, net_shape=net_shape
      )
      self.net = best_model.to(self.net.device)
  
      modules = [
          module
          for module in self.net.modules()
          if type(module) != torch.nn.Sequential
          and type(module) != DefaultNet
      ]
  
      self.encoder = torch.nn.Sequential(*modules[0:-1]).eval()
      self.decoder = torch.nn.Sequential(*modules[-1:]).eval()
      log.info("Categorical autoencoder ready.")
  
      self.is_prepared = True
  
imports: import random
  import numpy
  import torch
  from torch.utils.data import DataLoader
  from lightwood.mixer.helpers.ranger import Ranger
  from lightwood.encoder.categorical.simple_label import SimpleLabelEncoder
  from lightwood.encoder.categorical.onehot import OneHotEncoder
  from lightwood.encoder.categorical.gym import Gym
  from lightwood.encoder.base import BaseEncoder
  from lightwood.helpers.log import log
  from lightwood.mixer.helpers.default_net import DefaultNet
  import pandas
  from typing import Iterable, Tuple, List
label_desc: Use image node_id 2 for calling the CategoricalAutoEncoder obj's underlying member method code with example usage: obj.prepare(train_priming_data, dev_priming_data) without return types