class_docstr: Test some basic splitters.
docstr: Test RandomStratifiedSplitter on a singletask split.
code: def test_random_stratified_split(self):
      """
      Test RandomStratifiedSplitter on a singletask split.
      """
      np.random.seed(2314)
      # Test singletask case.
      n_samples = 20
      n_positives = 10
      n_features = 10
      n_tasks = 1
  
      X = np.random.rand(n_samples, n_features)
      y = np.zeros((n_samples, n_tasks))
      y[:n_positives] = 1
      w = np.ones((n_samples, n_tasks))
      ids = np.arange(n_samples)
      dataset = dc.data.DiskDataset.from_numpy(X, y, w, ids)
  
      stratified_splitter = dc.splits.RandomStratifiedSplitter()
      dataset_1, dataset_2 = stratified_splitter.train_test_split(
          dataset, frac_train=0.5
      )
      print(dataset_1.get_shape())
      print(dataset_2.get_shape())
  
      # Should have split cleanly in half (picked random seed to ensure this)
      assert len(dataset_1) == 10
      assert len(dataset_2) == 10
  
      # Check positives are correctly distributed
      y_1 = dataset_1.y
      assert np.count_nonzero(y_1) == n_positives / 2
  
      y_2 = dataset_2.y
      assert np.count_nonzero(y_2) == n_positives / 2
  
imports: import os
  import unittest
  import numpy
  import deepchem
  from deepchem.data import NumpyDataset
  from deepchem.splits import IndexSplitter
label_desc: Use image node_id 17 for calling the TestSplitter obj's underlying member method code with example usage: obj.test_random_stratified_split() without return types