class_docstr: RandomStratified Splitter class.
  
  For sparse multitask datasets, a standard split offers no guarantees that the
  splits will have any activate compounds. This class guarantees that each task
  will have a proportional split of the activates in a split. TO do this, a
  ragged split is performed with different numbers of compounds taken from each
  task. Thus, the length of the split arrays may exceed the split of the
  original array. That said, no datapoint is copied to more than one split, so
  correctness is still ensured.
  
  Note that this splitter is only valid for boolean label data.
  
  TODO(rbharath): This splitter should be refactored to match style of other
  splitter classes.
class_docstr_tok: ["RandomStratified","Splitter","class",".","For","sparse","multitask","datasets",",","a","standard","split","offers","no","guarantees","that","the","splits","will","have","any","activate","compounds",".","This","class","guarantees","that","each","task","will","have","a","proportional","split","of","the","activates","in","a","split",".","TO","do","this",",","a","ragged","split","is","performed","with","different","numbers","of","compounds","taken","from","each","task",".","Thus",",","the","length","of","the","split","arrays","may","exceed","the","split","of","the","original","array",".","That","said",",","no","datapoint","is","copied","to","more","than","one","split",",","so","correctness","is","still","ensured",".","Note","that","this","splitter","is","only","valid","for","boolean","label","data",".","TODO","(","rbharath",")",":","This","splitter","should","be","refactored","to","match","style","of","other","splitter","classes","."]
docstr: Method that does bulk of splitting dataset.
docstr_tok: ["Method","that","does","bulk","of","splitting","dataset","."]
code: def split(self, dataset, frac_split, split_dirs=None):
      """
      Method that does bulk of splitting dataset.
      """
      if split_dirs is not None:
          assert len(split_dirs) == 2
      else:
          split_dirs = [tempfile.mkdtemp(), tempfile.mkdtemp()]
  
      # Handle edge case where frac_split is 1
      if frac_split == 1:
          dataset_1 = NumpyDataset(
              dataset.X, dataset.y, dataset.w, dataset.ids
          )
          dataset_2 = None
          return dataset_1, dataset_2
      X, y, w, ids = randomize_arrays(
          (dataset.X, dataset.y, dataset.w, dataset.ids)
      )
      split_indices = self.get_task_split_indices(y, w, frac_split)
  
      # Create weight matrices fpor two haves.
      w_1, w_2 = np.zeros_like(w), np.zeros_like(w)
      for task, split_index in enumerate(split_indices):
          # copy over up to required index for weight first_split
          w_1[:split_index, task] = w[:split_index, task]
          w_2[split_index:, task] = w[split_index:, task]
  
      # check out if any rows in either w_1 or w_2 are just zeros
      rows_1 = w_1.any(axis=1)
      X_1, y_1, w_1, ids_1 = (
          X[rows_1],
          y[rows_1],
          w_1[rows_1],
          ids[rows_1],
      )
      dataset_1 = NumpyDataset(X_1, y_1, w_1, ids_1)
  
      rows_2 = w_2.any(axis=1)
      X_2, y_2, w_2, ids_2 = (
          X[rows_2],
          y[rows_2],
          w_2[rows_2],
          ids[rows_2],
      )
      dataset_2 = NumpyDataset(X_2, y_2, w_2, ids_2)
  
      return dataset_1, dataset_2
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import unicode_literals
  import tempfile
  import numpy
  import itertools
  from rdkit import Chem
  from rdkit import DataStructs
  from rdkit.Chem import AllChem
  from rdkit.ML.Cluster import Butina
  import deepchem
  from deepchem.data import DiskDataset
  from deepchem.utils import ScaffoldGenerator
  from deepchem.utils.save import log
  from deepchem.data import NumpyDataset
  from deepchem.utils.save import load_data
label_desc: Use image node_id 3 for calling the RandomStratifiedSplitter obj's underlying member method code with example usage: obj.split(dataset, frac_split, split_dirs) and returns: dataset_1,  dataset_2, dataset_1,  dataset_2