code: def _select_criterion(self) -> torch.nn.Module:
      if self.dtype_dict[self.target] in (
          dtype.categorical,
          dtype.binary,
      ):
          criterion = TransformCrossEntropyLoss(
              weight=self.target_encoder.index_weights.to(
                  self.model.device
              )
          )
      elif self.dtype_dict[self.target] in (
          dtype.tags,
          dtype.cat_tsarray,
      ):
          criterion = nn.BCEWithLogitsLoss()
      elif self.dtype_dict[self.target] in (dtype.cat_array,):
          criterion = nn.L1Loss()
      elif self.dtype_dict[self.target] in (
          dtype.integer,
          dtype.float,
          dtype.quantity,
          dtype.num_array,
      ):
          criterion = MSELoss()
      else:
          criterion = MSELoss()
  
      return criterion
  
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 3 for calling the Neural obj's underlying member method code with example usage: obj._select_criterion() and returns: criterion