class_docstr: Test grid hyperparameter optimization API.
class_docstr_tok: ["Test","grid","hyperparameter","optimization","API","."]
docstr: Set up common resources.
docstr_tok: ["Set","up","common","resources","."]
code: def setUp(self):
      """Set up common resources."""
  
      def rf_model_builder(**model_params):
          rf_params = {
              k: v
              for (k, v) in model_params.items()
              if k != "model_dir"
          }
          model_dir = model_params["model_dir"]
          sklearn_model = sklearn.ensemble.RandomForestRegressor(
              **rf_params
          )
          return dc.models.SklearnModel(sklearn_model, model_dir)
  
      self.rf_model_builder = rf_model_builder
      self.train_dataset = dc.data.NumpyDataset(
          X=np.random.rand(50, 5), y=np.random.rand(50, 1)
      )
      self.valid_dataset = dc.data.NumpyDataset(
          X=np.random.rand(20, 5), y=np.random.rand(20, 1)
      )
  
file_path: deepchem/deepchem/hyper/tests/test_grid_hyperparam_opt.py
imports: import unittest
  import tempfile
  import numpy
  import pytest
  import deepchem
  import sklearn
  import sklearn.ensemble
  import os
label_desc: Use image node_id 1 for calling the TestGridHyperparamOpt obj's underlying member method code with example usage: obj.setUp() and returns: dc