class_docstr: Class for doing data splits by stratification on a single task.
  
  Example:
  
  >>> n_samples = 100
  >>> n_features = 10
  >>> n_tasks = 10
  >>> X = np.random.rand(n_samples, n_features)
  >>> y = np.random.rand(n_samples, n_tasks)
  >>> w = np.ones_like(y)
  >>> dataset = DiskDataset.from_numpy(np.ones((100,n_tasks)), np.ones((100,n_tasks)), verbose=False)
  >>> splitter = SingletaskStratifiedSplitter(task_number=5, verbose=False)
  >>> train_dataset, test_dataset = splitter.train_test_split(dataset)
class_docstr_tok: ["Class","for","doing","data","splits","by","stratification","on","a","single","task",".","Example",":",">",">",">","n_samples","=","100",">",">",">","n_features","=","10",">",">",">","n_tasks","=","10",">",">",">","X","=","np.random.rand","(","n_samples",",","n_features",")",">",">",">","y","=","np.random.rand","(","n_samples",",","n_tasks",")",">",">",">","w","=","np.ones_like","(","y",")",">",">",">","dataset","=","DiskDataset.from_numpy","(","np.ones","(","(","100",",","n_tasks",")",")",",","np.ones","(","(","100",",","n_tasks",")",")",",","verbose=False",")",">",">",">","splitter","=","SingletaskStratifiedSplitter","(","task_number=5",",","verbose=False",")",">",">",">","train_dataset",",","test_dataset","=","splitter.train_test_split","(","dataset",")"]
docstr: Splits compounds into train/validation/test using stratified sampling.
  
  Parameters
  ----------
  dataset: dc.data.Dataset object
    Dataset.
  seed: int (Optional, Default None)
    Random seed.
  frac_train: float (Optional, Default .8)
    Fraction of dataset put into training data.
  frac_valid: float (Optional, Default .1)
    Fraction of dataset put into validation data.
  frac_test: float (Optional, Default .1)
    Fraction of dataset put into test data.
  log_every_n: int (Optional, Default None)
    Log every n examples (not currently used).
  
  Returns
  -------
  retval: Tuple
    Tuple containing train indices, valid indices, and test indices    
docstr_tok: ["Splits","compounds","into","train\/validation\/test","using","stratified","sampling",".","Parameters","--","--","--","--","--","dataset",":","dc.data.Dataset","object","Dataset",".","seed",":","int","(","Optional",",","Default","None",")","Random","seed",".","frac_train",":","float","(","Optional",",","Default",".8",")","Fraction","of","dataset","put","into","training","data",".","frac_valid",":","float","(","Optional",",","Default",".1",")","Fraction","of","dataset","put","into","validation","data",".","frac_test",":","float","(","Optional",",","Default",".1",")","Fraction","of","dataset","put","into","test","data",".","log_every_n",":","int","(","Optional",",","Default","None",")","Log","every","n","examples","(","not","currently","used",")",".","Returns","--","--","--","-","retval",":","Tuple","Tuple","containing","train","indices",",","valid","indices",",","and","test","indices"]
code: def split(
      self,
      dataset,
      seed=None,
      frac_train=0.8,
      frac_valid=0.1,
      frac_test=0.1,
      log_every_n=None,
  ):
      """
      Splits compounds into train/validation/test using stratified sampling.
  
      Parameters
      ----------
      dataset: dc.data.Dataset object
        Dataset.
      seed: int (Optional, Default None)
        Random seed.
      frac_train: float (Optional, Default .8)
        Fraction of dataset put into training data.
      frac_valid: float (Optional, Default .1)
        Fraction of dataset put into validation data.
      frac_test: float (Optional, Default .1)
        Fraction of dataset put into test data.
      log_every_n: int (Optional, Default None)
        Log every n examples (not currently used).
  
      Returns
      -------
      retval: Tuple
        Tuple containing train indices, valid indices, and test indices
      """
      # JSG Assert that split fractions can be written as proper fractions over 10.
      # This can be generalized in the future with some common demoninator determination.
      # This will work for 80/20 train/test or 80/10/10 train/valid/test (most use cases).
      np.testing.assert_equal(frac_train + frac_valid + frac_test, 1.0)
      np.testing.assert_equal(
          10 * frac_train + 10 * frac_valid + 10 * frac_test, 10.0
      )
  
      if not seed is None:
          np.random.seed(seed)
  
      y_s = dataset.y[:, self.task_number]
      sortidx = np.argsort(y_s)
  
      split_cd = 10
      train_cutoff = int(frac_train * split_cd)
      valid_cutoff = int(frac_valid * split_cd) + train_cutoff
      test_cutoff = int(frac_test * split_cd) + valid_cutoff
  
      train_idx = np.array([])
      valid_idx = np.array([])
      test_idx = np.array([])
  
      while sortidx.shape[0] >= split_cd:
          sortidx_split, sortidx = np.split(sortidx, [split_cd])
          shuffled = np.random.permutation(range(split_cd))
          train_idx = np.hstack(
              [train_idx, sortidx_split[shuffled[:train_cutoff]]]
          )
          valid_idx = np.hstack(
              [
                  valid_idx,
                  sortidx_split[shuffled[train_cutoff:valid_cutoff]],
              ]
          )
          test_idx = np.hstack(
              [test_idx, sortidx_split[shuffled[valid_cutoff:]]]
          )
  
      # Append remaining examples to train
      if sortidx.shape[0] > 0:
          np.hstack([train_idx, sortidx])
  
      return (train_idx, valid_idx, test_idx)
  
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 SingletaskStratifiedSplitter obj's underlying member method code with example usage: obj.split(dataset, seed, frac_train, frac_valid, frac_test, log_every_n) and returns: train_idx,  valid_idx,  test_idx