code: def test_sampling(text_classification_dataset_mock):
      # Arrange
      check = SingleDatasetPerformance(scorers=["recall_macro"])
      check_sampled = SingleDatasetPerformance(
          scorers=["recall_macro"], n_samples=2
      )
  
      # Act
      result = check.run(
          text_classification_dataset_mock, predictions=[0, 1, 1]
      )
      result_sampled = check_sampled.run(
          text_classification_dataset_mock,
          predictions=[0, 1, 1],
          random_state=42,
      )
  
      # Assert
      assert_that(result.value["Value"][0], close_to(0.75, 0.001))
      assert_that(
          result_sampled.value["Value"][0], close_to(0.25, 0.001)
      )
  
file_path: deepchecks/tests/nlp/test_context.py
imports: from hamcrest import assert_that, calling, close_to, raises
  from deepchecks.core.errors import ValidationError
  from deepchecks.nlp import Suite
  from deepchecks.nlp.checks import LabelDrift, SingleDatasetPerformance
label_desc: Use image node_id 4 for calling a global function with example usage: test_sampling(text_classification_dataset_mock) without return types