code: def test_fit_with_early_stopping(self):
      dataset = self._get_dataset(num_samples=20, num_classes=4)
  
      train_set = dataset[0:10]
      validation_set = dataset[10:]
  
      num_classes = 4
      embedding_matrix = torch.FloatTensor(np.random.rand(10, 100))
      classifier = KimCNNClassifier(
          num_classes,
          multi_label=self.multi_label,
          embedding_matrix=embedding_matrix,
          num_epochs=2,
      )
  
      early_stopping = EarlyStopping(Metric("val_loss"))
  
      with mock.patch.object(
          early_stopping,
          "check_early_stop",
          wraps=early_stopping.check_early_stop,
      ) as check_early_stop_spy:
          classifier.fit(
              train_set,
              validation_set=validation_set,
              early_stopping=early_stopping,
          )
          self.assertEqual(2, check_early_stop_spy.call_count)
          for i in range(2):
              self.assertEqual(
                  i + 1, check_early_stop_spy.call_args_list[i].args[0]
              )
              self.assertTrue(
                  "train_acc"
                  in check_early_stop_spy.call_args_list[i].args[1]
              )
  
imports: import unittest
  import pytest
  import numpy
  from unittest.mock import patch
  from unittest import mock
  from unittest.mock import Mock
  from scipy.sparse import issparse
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
  from small_text.training.early_stopping import EarlyStopping, NoopEarlyStopping
  from small_text.training.metrics import Metric
  from small_text.training.model_selection import ModelSelection, NoopModelSelection
label_desc: Use image node_id 7 for calling the _KimCNNClassifierTest obj's underlying member method code with example usage: obj.test_fit_with_early_stopping() without return types