code: def test_subspace_extraction():
      cs = ConfigurationSpace(0)
      cs.add_hyperparameter(UniformFloatHyperparameter("x0", 0.0, 1.0))
      cs.add_hyperparameter(
          CategoricalHyperparameter("x1", [0, 1, 2, 3, 4, 5])
      )
  
      rf = RandomForest(
          cs,
          num_trees=10,
          ratio_features=1.0,
          min_samples_split=2,
          min_samples_leaf=1,
          seed=0,
      )
  
      X = np.array([[0.0, 0], [0.2, 1], [0.3, 2], [0.7, 5], [0.6, 3]])
  
      Y = np.array([0.1, 0.2, 0.7, 0.6, 0.5])
  
      X_inc = np.array([0.4, 3])
      rf.train(X, Y)
      _, bounds = get_types(cs)
  
      ss_extraction_kwargs = dict(
          X=X,
          challenger=X_inc,
          model=rf,
          bounds=bounds,
          cat_dims=[1],
          cont_dims=[0],
      )
  
      num_min = 2
      num_max = 5
  
      ss_bounds_cont, ss_bounds_cat, ss_indices = subspace_extraction(
          num_min=num_min, num_max=np.inf, **ss_extraction_kwargs
      )
      assert num_min <= sum(ss_indices)
      x_in_ss = check_subspace_points(
          X_inc, [0], [1], ss_bounds_cont, ss_bounds_cat
      )
      assert x_in_ss[0]
      ss_indices_re_exam = check_subspace_points(
          X, [0], [1], ss_bounds_cont, ss_bounds_cat
      )
      assert sum(ss_indices) == sum(ss_indices_re_exam)
  
      ss_bounds_cont, ss_bounds_cat, ss_indices = subspace_extraction(
          num_min=num_min, num_max=num_max, **ss_extraction_kwargs
      )
      assert num_min <= sum(ss_indices) <= num_max
      x_in_ss = check_subspace_points(
          X_inc, [0], [1], ss_bounds_cont, ss_bounds_cat
      )
      assert x_in_ss[0]
      ss_indices_re_exam = check_subspace_points(
          X, [0], [1], ss_bounds_cont, ss_bounds_cat
      )
      assert sum(ss_indices) == sum(ss_indices_re_exam)
  
      num_max = 3
      ss_bounds_cont, ss_bounds_cat, ss_indices = subspace_extraction(
          num_min=num_min, num_max=num_max, **ss_extraction_kwargs
      )
      assert num_min <= sum(ss_indices) <= num_max
      assert x_in_ss[0]
      ss_indices_re_exam = check_subspace_points(
          X, [0], [1], ss_bounds_cont, ss_bounds_cat
      )
      assert sum(ss_indices) == sum(ss_indices_re_exam)
  
file_path: SMAC3/tests/test_main/_test_boing.py
imports: from unittest.mock import patch
  import numpy
  import pytest
  from ConfigSpace import CategoricalHyperparameter, ConfigurationSpace, UniformFloatHyperparameter
  import smac
  from smac.facade.blackbox_facade import BlackBoxFacade
  from smac.facade.hyperparameter_optimization_facade import HyperparameterOptimizationFacade
  from smac.facade.old.boing_facade import BOinGFacade
  from smac.main.boing import subspace_extraction
  from smac.model.random_forest.random_forest import RandomForest
  from smac.model.utils import check_subspace_points, get_types
  from smac.runhistory.runhistory import RunHistory
  from smac.runner.abstract_runner import StatusType
  from smac.utils import _test_helpers
label_desc: Use image node_id 4 for calling a global function with example usage: test_subspace_extraction() without return types