class_docstr: Test some basic splitters.
docstr: Test that (K-1) folds can be merged into train dataset.
docstr_tok: ["Test","that","(","K-1",")","folds","can","be","merged","into","train","dataset","."]
code: def test_merge_fold_datasets(self):
      """Test that (K-1) folds can be merged into train dataset."""
      n_samples = 100
      n_features = 10
      n_tasks = 10
      X = np.random.rand(n_samples, n_features)
      p = 0.05  # proportion actives
      y = np.random.binomial(1, p, size=(n_samples, n_tasks))
      w = np.ones((n_samples, n_tasks))
      dataset = dc.data.NumpyDataset(X, y, w)
      K = 5
  
      task_splitter = dc.splits.TaskSplitter()
      fold_datasets = task_splitter.k_fold_split(dataset, K)
      # Number tasks per fold
      n_per_fold = 2
  
      for fold in range(K):
          train_inds = list(set(range(K)) - set([fold]))
          train_fold_datasets = [
              fold_datasets[ind] for ind in train_inds
          ]
          train_dataset = dc.splits.merge_fold_datasets(
              train_fold_datasets
          )
  
          # Find the tasks that correspond to this test fold
          train_tasks = list(
              set(range(10))
              - set(range(fold * n_per_fold, (fold + 1) * n_per_fold))
          )
  
          # Assert that all arrays look like they should
          np.testing.assert_array_equal(train_dataset.X, X)
          np.testing.assert_array_equal(
              train_dataset.y, y[:, train_tasks]
          )
          np.testing.assert_array_equal(
              train_dataset.w, w[:, train_tasks]
          )
          np.testing.assert_array_equal(train_dataset.X, X)
  
file_path: deepchem/deepchem/splits/tests/test_task_splitter.py
imports: import unittest
  import numpy
  import deepchem
label_desc: Use image node_id 5 for calling the TestTaskSplitters obj's underlying member method code with example usage: obj.test_merge_fold_datasets() without return types