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 k-folds using stratified sampling.
  Overriding base class k_fold_split.
  
  Parameters
  ----------
  dataset: dc.data.Dataset object
    Dataset.
  k: int
    Number of folds.
  seed: int (Optional, Default None)
    Random seed.
  log_every_n: int (Optional, Default None)
    Log every n examples (not currently used).
  
  Returns
  -------
  fold_datasets: List
    List containing dc.data.Dataset objects
docstr_tok: ["Splits","compounds","into","k-folds","using","stratified","sampling",".","Overriding","base","class","k_fold_split",".","Parameters","--","--","--","--","--","dataset",":","dc.data.Dataset","object","Dataset",".","k",":","int","Number","of","folds",".","seed",":","int","(","Optional",",","Default","None",")","Random","seed",".","log_every_n",":","int","(","Optional",",","Default","None",")","Log","every","n","examples","(","not","currently","used",")",".","Returns","--","--","--","-","fold_datasets",":","List","List","containing","dc.data.Dataset","objects"]
code: def k_fold_split(self, dataset, k, seed=None, log_every_n=None):
      """
      Splits compounds into k-folds using stratified sampling.
      Overriding base class k_fold_split.
  
      Parameters
      ----------
      dataset: dc.data.Dataset object
        Dataset.
      k: int
        Number of folds.
      seed: int (Optional, Default None)
        Random seed.
      log_every_n: int (Optional, Default None)
        Log every n examples (not currently used).
  
      Returns
      -------
      fold_datasets: List
        List containing dc.data.Dataset objects
      """
      log("Computing K-fold split", self.verbose)
      if directories is None:
          directories = [tempfile.mkdtemp() for _ in range(k)]
      else:
          assert len(directories) == k
  
      y_s = dataset.y[:, self.task_number]
      sortidx = np.argsort(y_s)
      sortidx_list = np.array_split(sortidx, k)
  
      fold_datasets = []
      for fold in range(k):
          fold_dir = directories[fold]
          fold_ind = sortidx_list[fold]
          fold_dataset = dataset.select(fold_ind, fold_dir)
          fold_datasets.append(fold_dataset)
      return fold_datasets
  
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 2 for calling the SingletaskStratifiedSplitter obj's underlying member method code with example usage: obj.k_fold_split(dataset, k, seed, log_every_n) and returns: fold_datasets