code: def test_balanced_sampling(self):
      y = [0] * 10 + [1] * 10 + [2] * 10 + [3] * 70
      indices = balanced_sampling(y, n_samples=10)
      stratified_labels = [y[i] for i in indices]
  
      counts = _get_class_histogram(stratified_labels, 4)
      self.assertEqual(10, len(indices))
      self.assertEqual(10, len(np.unique(indices)))
      self.assertEqual(4, len(np.unique(stratified_labels)))
  
      self.assertTrue(np.all(counts >= 2))
  
file_path: small-text/tests/unit/small_text/data/test_sampling.py
imports: import unittest
  import numpy
  from small_text.data import balanced_sampling, stratified_sampling
  from small_text.data.sampling import _get_class_histogram
label_desc: Use image node_id 1 for calling the BalancedSamplingTest obj's underlying member method code with example usage: obj.test_balanced_sampling() without return types