class_docstr: Test singletask/multitask data loading.
docstr: Check that singletask load and multitask load of dataset are same.
code: def test_singletask_matches_multitask_load(self):
      """Check that singletask load and multitask load of dataset are same."""
      # Only for debug!
      np.random.seed(123)
  
      current_dir = os.path.dirname(os.path.realpath(__file__))
      # Make directories to store the raw and featurized datasets.
      data_dir = tempfile.mkdtemp()
  
      # Load dataset
      logger.info("About to load dataset.")
      dataset_file = os.path.join(
          current_dir, "../../models/tests/assets/multitask_example.csv"
      )
  
      # Featurize tox21 dataset
      logger.info("About to featurize dataset.")
      featurizer = dc.feat.CircularFingerprint(size=1024)
      all_tasks = ["task%d" % i for i in range(17)]
      # For debugging purposes
      n_tasks = 17
      tasks = all_tasks[0:n_tasks]
  
      # multitask load
      loader = dc.data.CSVLoader(
          tasks=tasks, feature_field="smiles", featurizer=featurizer
      )
      dataset = loader.create_dataset(dataset_file, data_dir)
  
      # Do train/valid split.
      _, y_multi, w_multi, _ = (
          dataset.X,
          dataset.y,
          dataset.w,
          dataset.ids,
      )
  
      # singletask load
      y_tasks, w_tasks, ids_tasks = [], [], []
      for task in tasks:
          logger.info("Processing task %s" % task)
          if os.path.exists(data_dir):
              shutil.rmtree(data_dir)
          loader = dc.data.CSVLoader(
              tasks=[task],
              feature_field="smiles",
              featurizer=featurizer,
          )
          dataset = loader.create_dataset(dataset_file, data_dir)
  
          _, y_task, w_task, ids_task = (
              dataset.X,
              dataset.y,
              dataset.w,
              dataset.ids,
          )
          y_tasks.append(y_task)
          w_tasks.append(w_task)
          ids_tasks.append(ids_task)
  
      # comparison
      for ind, task in enumerate(tasks):
          y_multi_task = y_multi[:, ind]
          w_multi_task = w_multi[:, ind]
  
          y_task = y_tasks[ind]
          w_task = w_tasks[ind]
          ids_task = ids_tasks[ind]
  
          np.testing.assert_allclose(
              y_multi_task.flatten(), y_task.flatten()
          )
          np.testing.assert_allclose(
              w_multi_task.flatten(), w_task.flatten()
          )
  
file_path: deepchem/deepchem/data/tests/test_load.py
imports: import os
  import shutil
  import logging
  import unittest
  import tempfile
  import deepchem
  import numpy
label_desc: Use image node_id 3 for calling the TestLoad obj's underlying member method code with example usage: obj.test_singletask_matches_multitask_load() without return types