class_docstr: Class for doing data splits by stratification on a single task.
  
  Examples
  --------
  >>> 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)))
  >>> splitter = SingletaskStratifiedSplitter(task_number=5)
  >>> train_dataset, test_dataset = splitter.train_test_split(dataset)
class_docstr_tok: ["Class","for","doing","data","splits","by","stratification","on","a","single","task",".","Examples","--","--","--","--",">",">",">","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",")",")",")",">",">",">","splitter","=","SingletaskStratifiedSplitter","(","task_number=5",")",">",">",">","train_dataset",",","test_dataset","=","splitter.train_test_split","(","dataset",")"]
docstr: Creates splitter object.
  
  Parameters
  ----------
  task_number: int, optional (default 0)
      Task number for stratification.
docstr_tok: ["Creates","splitter","object",".","Parameters","--","--","--","--","--","task_number",":","int",",","optional","(","default","0",")","Task","number","for","stratification","."]
code: def __init__(self, task_number: int = 0):
      """
      Creates splitter object.
  
      Parameters
      ----------
      task_number: int, optional (default 0)
          Task number for stratification.
      """
      self.task_number = task_number
  
imports: import inspect
  import itertools
  import logging
  import os
  import random
  import tempfile
  from typing import Any, Dict, Iterator, List, Optional, Sequence, Tuple, Union
  import deepchem
  import numpy
  import pandas
  from deepchem.data import Dataset, DiskDataset
  from deepchem.utils import get_print_threshold
label_desc: Use image node_id 1 to create a new SingletaskStratifiedSplitter object from inherited base classes: Splitter with example: obj = SingletaskStratifiedSplitter(task_number)