code: def _test_regressor(Regressor, dataset="diabetes", sparse=False):
      X_train, Y_train, X_test, Y_test = get_dataset(
          dataset=dataset, make_sparse=sparse
      )
      configuration_space = Regressor.get_hyperparameter_search_space()
      default_config = configuration_space.get_default_configuration()
  
      regressor = Regressor(random_state=0, **default_config)
  
      # Dumb incomplete hacky test to check that we do not alter the data
      X_train_hash = hash(str(X_train))
      X_test_hash = hash(str(X_test))
      Y_train_hash = hash(str(Y_train))
  
      if hasattr(regressor, "iterative_fit"):
  
          class counter(object):
              def __init__(self, func):
                  self.n_calls = 0
                  self.func = func
  
              def __call__(self, *args, **kwargs):
                  self.n_calls += 1
                  return self.func(*args, **kwargs)
  
          regressor.iterative_fit = counter(regressor.iterative_fit)
  
      predictor = regressor.fit(X_train, Y_train)
  
      if hasattr(regressor, "iterative_fit"):
          n_calls = regressor.iterative_fit.n_calls
      else:
          n_calls = None
  
      predictions = predictor.predict(X_test)
      if (
          X_train_hash != hash(str(X_train))
          or X_test_hash != hash(str(X_test))
          or Y_train_hash != hash(str(Y_train))
      ):
          raise ValueError("Model modified data")
      return predictions, Y_test, n_calls
  
imports: import importlib
  import inspect
  import os
  import pkgutil
  import numpy
  import scipy.sparse
  import sklearn
  import sklearn.base
  import sklearn.datasets
  import unittest
label_desc: Use image node_id 7 for calling a global function with example usage: _test_regressor(Regressor, dataset, sparse) and returns: predictions,  Y_test,  n_calls, self