docstr: Obtains validation scores (loss, accuracy) for the given validation set.
  
  Parameters
  ----------
  validation_set : PytorchTextClassificationDataset
      Validation set.
  
  Returns
  -------
  validation_loss : float
      Validation loss.
  validation_acc : float
      Validation accuracy.
docstr_tok: ["Obtains","validation","scores","(","loss",",","accuracy",")","for","the","given","validation","set",".","Parameters","--","--","--","--","--","validation_set",":","PytorchTextClassificationDataset","Validation","set",".","Returns","--","--","--","-","validation_loss",":","float","Validation","loss",".","validation_acc",":","float","Validation","accuracy","."]
code: def validate(self, validation_set):
      """Obtains validation scores (loss, accuracy) for the given validation set.
  
      Parameters
      ----------
      validation_set : PytorchTextClassificationDataset
          Validation set.
  
      Returns
      -------
      validation_loss : float
          Validation loss.
      validation_acc : float
          Validation accuracy.
      """
      valid_loss = 0.0
      acc = 0.0
  
      self.model.eval()
      valid_iter = dataloader(
          validation_set.data,
          self.mini_batch_size,
          self._create_collate_fn(),
          train=False,
      )
  
      for x, cls, weight, *_ in valid_iter:
          x, cls, weight = (
              x.to(self.device),
              cls.to(self.device),
              weight.to(self.device),
          )
  
          with torch.no_grad():
              if self.num_classes == 2:
                  target = F.one_hot(cls, 2).float()
              else:
                  target = cls
  
              output = self.model(x)
              loss = self.criterion(output, target)
              loss = loss * weight
              loss = loss.mean()
  
              valid_loss += loss.item()
  
              acc += self.sum_up_accuracy_(output, cls)
              del output, x, cls
  
      return valid_loss / len(validation_set), acc / len(validation_set)
  
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 10 for calling the KimCNNClassifier obj's underlying member method code with example usage: obj.validate(validation_set) and returns: unknown,  unknown