class_docstr: Test that support generation happens properly.
class_docstr_tok: ["Test","that","support","generation","happens","properly","."]
docstr: Test that random index can be removed from dataset.
docstr_tok: ["Test","that","random","index","can","be","removed","from","dataset","."]
code: def test_dataset_difference(self):
      """Test that random index can be removed from dataset."""
      n_samples = 10
      n_remove = 4
      n_features = 3
      n_tasks = 1
  
      # Generate dummy dataset
      np.random.seed(123)
      ids = np.arange(n_samples)
      X = np.random.rand(n_samples, n_features)
      y = np.random.randint(2, size=(n_samples, n_tasks))
      w = np.ones((n_samples, n_tasks))
      dataset = dc.data.NumpyDataset(X, y, w, ids)
  
      remove_inds = sorted(
          np.random.choice(
              np.arange(n_samples), (n_remove,), replace=False
          )
      )
      remove_dataset = dc.data.NumpyDataset(
          X[remove_inds],
          y[remove_inds],
          w[remove_inds],
          ids[remove_inds],
      )
  
      out_dataset = dc.data.dataset_difference(dataset, remove_dataset)
  
      # Assert all remove elements have been removed
      data_inds = sorted(list(set(range(n_samples)) - set(remove_inds)))
      assert len(out_dataset) == n_samples - n_remove
      np.testing.assert_array_equal(out_dataset.X, X[data_inds])
      np.testing.assert_array_equal(out_dataset.y, y[data_inds])
      np.testing.assert_array_equal(out_dataset.w, w[data_inds])
      np.testing.assert_array_equal(out_dataset.ids, ids[data_inds])
  
file_path: deepchem/deepchem/data/tests/test_support_generator.py
imports: import logging
  import numpy
  import unittest
  import deepchem
label_desc: Use image node_id 10 for calling the TestSupports obj's underlying member method code with example usage: obj.test_dataset_difference() without return types