docstr: The Neural mixer trains a fully connected dense network from concatenated encoded outputs of each of the features in the dataset to predicted the encoded output. 
  
  :param stop_after: How long the total fitting process should take
  :param target: Name of the target column
  :param dtype_dict: Data type dictionary
  :param target_encoder: Reference to the encoder used for the target
  :param net: The network type to use (`DeafultNet` or `ArNet`)
  :param fit_on_dev: If we should fit on the dev dataset
  :param search_hyperparameters: If the network should run a more through hyperparameter search (currently disabled)
  :param n_epochs: amount of epochs that the network will be trained for. Supersedes all other early stopping criteria if specified.
  :param lr: learning rate for the network. By default, it is automatically selected based on an initial search process.
code: def __init__(
      self,
      stop_after: float,
      target: str,
      dtype_dict: Dict[str, str],
      target_encoder: BaseEncoder,
      net: str,
      fit_on_dev: bool,
      search_hyperparameters: bool,
      n_epochs: Optional[int] = None,
      lr: Optional[float] = None,
  ):
      """
      The Neural mixer trains a fully connected dense network from concatenated encoded outputs of each of the features in the dataset to predicted the encoded output.
  
      :param stop_after: How long the total fitting process should take
      :param target: Name of the target column
      :param dtype_dict: Data type dictionary
      :param target_encoder: Reference to the encoder used for the target
      :param net: The network type to use (`DeafultNet` or `ArNet`)
      :param fit_on_dev: If we should fit on the dev dataset
      :param search_hyperparameters: If the network should run a more through hyperparameter search (currently disabled)
      :param n_epochs: amount of epochs that the network will be trained for. Supersedes all other early stopping criteria if specified.
      :param lr: learning rate for the network. By default, it is automatically selected based on an initial search process.
      """  # noqa
      super().__init__(stop_after)
      self.dtype_dict = dtype_dict
      self.target = target
      self.target_encoder = target_encoder
      self.num_hidden = 1
      self.epochs_to_best = 0
      self.n_epochs = n_epochs
      self.lr = lr
      self.loss_hist_len = (
          7  # length of queue to use for early stopping
      )
      self.fit_on_dev = fit_on_dev
      self.net_name = net
      self.supports_proba = dtype_dict[target] in [
          dtype.binary,
          dtype.categorical,
      ]
      self.search_hyperparameters = search_hyperparameters
      self.stable = True
  
imports: import time
  from copy import deepcopy
  from collections import deque
  from typing import Dict, List, Optional
  import torch
  import numpy
  import pandas
  from torch import nn
  import torch_optimizer
  from sklearn.metrics import r2_score
  from torch.cuda.amp import GradScaler
  from torch.utils.data import DataLoader
  from torch.nn.modules.loss import MSELoss
  from torch.optim.optimizer import Optimizer
  from type_infer.dtype import dtype
  from lightwood.helpers.log import log
  from lightwood.encoder.base import BaseEncoder
  from lightwood.helpers.torch import LightwoodAutocast
  from lightwood.data.encoded_ds import EncodedDs
  from lightwood.mixer.base import BaseMixer
  from lightwood.mixer.helpers.ar_net import ArNet
  from lightwood.mixer.helpers.default_net import DefaultNet
  from lightwood.api.types import PredictionArguments
  from lightwood.mixer.helpers.transform_corss_entropy_loss import TransformCrossEntropyLoss
label_desc: Use image node_id 1 to create a new Neural object from inherited base classes: BaseMixer with example: obj = Neural(stop_after, target, dtype_dict, target_encoder, net, fit_on_dev, search_hyperparameters, n_epochs, lr)