docstr: :param train_data: The network is fit/trained on this
  :param dev_data: Data used for early stopping and hyperparameter determination
docstr_tok: [":","param","train_data",":","The","network","is","fit\/trained","on","this",":","param","dev_data",":","Data","used","for","early","stopping","and","hyperparameter","determination"]
code: def _fit(self, train_data: EncodedDs, dev_data: EncodedDs) -> None:
      """
      :param train_data: The network is fit/trained on this
      :param dev_data: Data used for early stopping and hyperparameter determination
      """  # noqa
      self.started = time.time()
      original_train = deepcopy(train_data.data_frame)
      original_dev = deepcopy(dev_data.data_frame)
  
      # ConcatedEncodedDs
      self.batch_size = min(200, int(len(train_data) / 10))
      self.batch_size = max(40, self.batch_size)
  
      dev_dl = DataLoader(
          dev_data, batch_size=self.batch_size, shuffle=False
      )
      train_dl = DataLoader(
          train_data, batch_size=self.batch_size, shuffle=False
      )
  
      self.lr = 1e-4
      self.num_hidden = 1
  
      # Find learning rate
      # keep the weights
      self._init_net(train_data)
      self.lr, self.model = self._find_lr(train_data)
  
      # Keep on training
      optimizer = self._select_optimizer(self.model, lr=self.lr)
      criterion = self._select_criterion()
      scaler = GradScaler()
  
      # Only 0.8 of the remaining time budget is used to allow some time for the final tuning and partial fit
      self.model, epoch_to_best_model, _ = self._max_fit(
          train_dl,
          dev_dl,
          criterion,
          optimizer,
          scaler,
          (self.stop_after - (time.time() - self.started)) * 0.8,
          return_model_after=20000,
      )
  
      self.epochs_to_best += epoch_to_best_model
  
      # restore dfs
      train_data.data_frame = original_train
      dev_data.data_frame = original_dev
  
      if self.fit_on_dev:
          self.partial_fit(dev_data, train_data)
  
imports: import time
  from copy import deepcopy
  from typing import Dict, Optional, List
  import numpy
  import pandas
  import torch
  from torch import nn
  from torch.cuda.amp import GradScaler
  from torch.utils.data import DataLoader
  from type_infer.dtype import dtype
  from lightwood.api.types import PredictionArguments
  from lightwood.encoder.base import BaseEncoder
  from lightwood.data.encoded_ds import EncodedDs, ConcatedEncodedDs
  from lightwood.mixer.neural import Neural
  from lightwood.mixer.helpers.ar_net import ArNet
  from lightwood.mixer.helpers.default_net import DefaultNet
  from lightwood.api.types import TimeseriesSettings
label_desc: Use image node_id 3 for calling the NeuralTs obj's underlying member method code with example usage: obj._fit(train_data, dev_data) without return types