docstr: num_classes : int
      Number of classes.
  multi_label : bool, default=False
      If `False`, the classes are mutually exclusive, i.e. the prediction step results in
      exactly one predicted label per instance.
  embedding_matrix : torch.FloatTensor
      A tensor of embeddings in the shape of (vocab_size, embedding_size).
  device : str or torch.device, default=None
      Torch device on which the computation will be performed.
  num_epochs : int, default=10
      Epochs to train.
  mini_batch_size : int, default=12
      Size of mini batches during training.
  lr : float, default=2e-5
      Learning rate.
  max_seq_len : int
      Maximum sequence length.
  out_channels : int
      Number of output channels.
  filter_padding : int
      Size of the padding to add before and after the sequence before applying the filters.
  dropout : float
      Dropout probability for the final layer in KimCNN.
  validation_set_size : float, default=0.1
      The size of the validation set as a fraction of the training set.
  padding_idx : int
      Index of the padding token (as given by the `vocab`).
  kernel_heights : list of int
      Kernel sizes.
  early_stopping : int
      Number of epochs with no improvement in validation loss until early stopping
      is triggered.
  
       .. deprecated:: 1.1.0
         Use the `early_stopping` kwarg in `fit()` instead.
  early_stopping_acc : float
      Accuracy threshold in the interval (0, 1] which triggers early stopping.
  
      .. deprecated:: 1.1.0
         Use the `early_stopping` kwarg in `fit()` instead.
  class_weight : 'balanced' or None, default=None
      If 'balanced', then the loss function is weighted inversely proportional to the
      label distribution to the current train set.
docstr_tok: ["num_classes",":","int","Number","of","classes",".","multi_label",":","bool",",","default=False","If","`","False","`",",","the","classes","are","mutually","exclusive",",","i.e",".","the","prediction","step","results","in","exactly","one","predicted","label","per","instance",".","embedding_matrix",":","torch.FloatTensor","A","tensor","of","embeddings","in","the","shape","of","(","vocab_size",",","embedding_size",")",".","device",":","str","or","torch.device",",","default=None","Torch","device","on","which","the","computation","will","be","performed",".","num_epochs",":","int",",","default=10","Epochs","to","train",".","mini_batch_size",":","int",",","default=12","Size","of","mini","batches","during","training",".","lr",":","float",",","default=2e-5","Learning","rate",".","max_seq_len",":","int","Maximum","sequence","length",".","out_channels",":","int","Number","of","output","channels",".","filter_padding",":","int","Size","of","the","padding","to","add","before","and","after","the","sequence","before","applying","the","filters",".","dropout",":","float","Dropout","probability","for","the","final","layer","in","KimCNN",".","validation_set_size",":","float",",","default=0.1","The","size","of","the","validation","set","as","a","fraction","of","the","training","set",".","padding_idx",":","int","Index","of","the","padding","token","(","as","given","by","the","`","vocab","`",")",".","kernel_heights",":","list","of","int","Kernel","sizes",".","early_stopping",":","int","Number","of","epochs","with","no","improvement","in","validation","loss","until","early","stopping","is","triggered",".","..","deprecated",":",":","1.1.0","Use","the","`","early_stopping","`","kwarg","in","`","fit","(",")","`","instead",".","early_stopping_acc",":","float","Accuracy","threshold","in","the","interval","(","0",",","1","]","which","triggers","early","stopping",".","..","deprecated",":",":","1.1.0","Use","the","`","early_stopping","`","kwarg","in","`","fit","(",")","`","instead",".","class_weight",":","'balanced","'","or","None",",","default=None","If","'balanced","'",",","then","the","loss","function","is","weighted","inversely","proportional","to","the","label","distribution","to","the","current","train","set","."]
code: def __init__(
      self,
      num_classes,
      multi_label=False,
      embedding_matrix=None,
      device=None,
      num_epochs=10,
      mini_batch_size=25,
      lr=0.001,
      max_seq_len=60,
      out_channels=100,
      filter_padding=0,
      dropout=0.5,
      validation_set_size=0.1,
      padding_idx=0,
      kernel_heights=[3, 4, 5],
      early_stopping=5,
      early_stopping_acc=-1,
      class_weight=None,
      verbosity=VERBOSITY_MORE_VERBOSE,
  ):
      """
      num_classes : int
          Number of classes.
      multi_label : bool, default=False
          If `False`, the classes are mutually exclusive, i.e. the prediction step results in
          exactly one predicted label per instance.
      embedding_matrix : torch.FloatTensor
          A tensor of embeddings in the shape of (vocab_size, embedding_size).
      device : str or torch.device, default=None
          Torch device on which the computation will be performed.
      num_epochs : int, default=10
          Epochs to train.
      mini_batch_size : int, default=12
          Size of mini batches during training.
      lr : float, default=2e-5
          Learning rate.
      max_seq_len : int
          Maximum sequence length.
      out_channels : int
          Number of output channels.
      filter_padding : int
          Size of the padding to add before and after the sequence before applying the filters.
      dropout : float
          Dropout probability for the final layer in KimCNN.
      validation_set_size : float, default=0.1
          The size of the validation set as a fraction of the training set.
      padding_idx : int
          Index of the padding token (as given by the `vocab`).
      kernel_heights : list of int
          Kernel sizes.
      early_stopping : int
          Number of epochs with no improvement in validation loss until early stopping
          is triggered.
  
           .. deprecated:: 1.1.0
             Use the `early_stopping` kwarg in `fit()` instead.
      early_stopping_acc : float
          Accuracy threshold in the interval (0, 1] which triggers early stopping.
  
          .. deprecated:: 1.1.0
             Use the `early_stopping` kwarg in `fit()` instead.
      class_weight : 'balanced' or None, default=None
          If 'balanced', then the loss function is weighted inversely proportional to the
          label distribution to the current train set.
      """
      super().__init__(
          multi_label=multi_label,
          device=device,
          mini_batch_size=mini_batch_size,
      )
      early_stopping_deprecation_warning(
          early_stopping, early_stopping_acc
      )
  
      with verbosity_logger():
          self.logger = logging.getLogger(__name__)
          self.logger.verbosity = verbosity
  
      if embedding_matrix is None:
          raise ValueError(
              "This implementation requires an embedding matrix."
          )
  
      # Training parameters
      self.num_classes = num_classes
      self.num_epochs = num_epochs
      self.lr = lr
  
      self.criterion = None
      self.optimizer = None
      self.scheduler = None
  
      self.class_weight = class_weight
  
      # KimCNN (pytorch model) parameters
      self.max_seq_len = max_seq_len
      self.out_channels = out_channels
      self.filter_padding = filter_padding
      self.dropout = dropout
      self.validation_set_size = validation_set_size
      self.embedding_matrix = embedding_matrix
      self.padding_idx = padding_idx
      self.kernel_heights = kernel_heights
  
      self.early_stopping = early_stopping
      self.early_stopping_acc = early_stopping_acc
  
      self.model = None
      self.model_selection = None
      self.enc_ = None
  
imports: import datetime
  import logging
  import tempfile
  import numpy
  from functools import partial
  from sklearn.preprocessing import MultiLabelBinarizer
  from small_text.classifiers.classification import EmbeddingMixin
  from small_text.integrations.pytorch.classifiers.base import PytorchClassifier
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
  from small_text.integrations.pytorch.models.kimcnn import KimCNN
  from small_text.utils.classification import get_splits
  from small_text.utils.context import build_pbar_context
  from small_text.utils.data import check_training_data, list_length
  from small_text.utils.annotations import early_stopping_deprecation_warning
  from small_text.utils.labels import csr_to_list, get_num_labels
  from small_text.utils.datetime import format_timedelta
  from small_text.utils.logging import verbosity_logger, VERBOSITY_MORE_VERBOSE
  from small_text.utils.system import get_tmp_dir_base
label_desc: Use image node_id 1 to create a new KimCNNClassifier object from inherited base classes: KimCNNEmbeddingMixin, PytorchClassifier with example: obj = KimCNNClassifier(num_classes, multi_label, embedding_matrix, device, num_epochs, mini_batch_size, lr, max_seq_len, out_channels, filter_padding, dropout, validation_set_size, padding_idx, kernel_heights, early_stopping, early_stopping_acc, class_weight, verbosity)