class_docstr: Provides a simple interface for splitting datasets task-wise.
  
  For some learning problems, the training and test datasets should
  have different tasks entirely. This is a different paradigm from the
  usual Splitter, which ensures that split datasets have different
  datapoints, not different tasks.
docstr: Performs a train/valid/test split of the tasks for dataset.
  
  If split is uneven, spillover goes to test.
  
  Parameters
  ----------
  dataset: dc.data.Dataset
      Dataset to be split
  frac_train: float, optional
      Proportion of tasks to be put into train. Rounded to nearest int.
  frac_valid: float, optional
      Proportion of tasks to be put into valid. Rounded to nearest int.
  frac_test: float, optional
      Proportion of tasks to be put into test. Rounded to nearest int.
docstr_tok: ["Performs","a","train\/valid\/test","split","of","the","tasks","for","dataset",".","If","split","is","uneven",",","spillover","goes","to","test",".","Parameters","--","--","--","--","--","dataset",":","dc.data.Dataset","Dataset","to","be","split","frac_train",":","float",",","optional","Proportion","of","tasks","to","be","put","into","train",".","Rounded","to","nearest","int",".","frac_valid",":","float",",","optional","Proportion","of","tasks","to","be","put","into","valid",".","Rounded","to","nearest","int",".","frac_test",":","float",",","optional","Proportion","of","tasks","to","be","put","into","test",".","Rounded","to","nearest","int","."]
code: def train_valid_test_split(
      self, dataset, frac_train=0.8, frac_valid=0.1, frac_test=0.1
  ):
      """Performs a train/valid/test split of the tasks for dataset.
  
      If split is uneven, spillover goes to test.
  
      Parameters
      ----------
      dataset: dc.data.Dataset
          Dataset to be split
      frac_train: float, optional
          Proportion of tasks to be put into train. Rounded to nearest int.
      frac_valid: float, optional
          Proportion of tasks to be put into valid. Rounded to nearest int.
      frac_test: float, optional
          Proportion of tasks to be put into test. Rounded to nearest int.
      """
      np.testing.assert_almost_equal(
          frac_train + frac_valid + frac_test, 1
      )
      n_tasks = len(dataset.get_task_names())
      n_train = int(np.round(frac_train * n_tasks))
      n_valid = int(np.round(frac_valid * n_tasks))
  
      X, y, w, ids = dataset.X, dataset.y, dataset.w, dataset.ids
  
      train_dataset = NumpyDataset(
          X, y[:, :n_train], w[:, :n_train], ids
      )
      valid_dataset = NumpyDataset(
          X,
          y[:, n_train : n_train + n_valid],
          w[:, n_train : n_train + n_valid],
          ids,
      )
      test_dataset = NumpyDataset(
          X, y[:, n_train + n_valid :], w[:, n_train + n_valid :], ids
      )
      return train_dataset, valid_dataset, test_dataset
  
file_path: deepchem/deepchem/splits/task_splitter.py
imports: import numpy
  from deepchem.data import NumpyDataset
  from deepchem.splits import Splitter
label_desc: Use image node_id 2 for calling the TaskSplitter obj's underlying member method code with example usage: obj.train_valid_test_split(dataset, frac_train, frac_valid, frac_test) and returns: train_dataset,  valid_dataset,  test_dataset