Skip to content

Commit 33463c7

Browse files
committed
TEST try decision tree instead of rf to reduce memory footprint
1 parent 48d7fc8 commit 33463c7

File tree

2 files changed

+12
-39
lines changed

2 files changed

+12
-39
lines changed

test/test_pipeline/test_classification.py

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ def _test_configurations(self, configurations_space, make_sparse=False,
293293
print(config)
294294
raise e
295295

296-
297296
def test_get_hyperparameter_search_space(self):
298297
cs = SimpleClassificationPipeline.get_hyperparameter_search_space()
299298
self.assertIsInstance(cs, ConfigurationSpace)
@@ -388,7 +387,8 @@ def test_get_hyperparameter_search_space_dataset_properties(self):
388387
self.assertEqual(cs_ml, cs_mc_ml)
389388

390389
def test_predict_batched(self):
391-
cs = SimpleClassificationPipeline.get_hyperparameter_search_space()
390+
cs = SimpleClassificationPipeline.get_hyperparameter_search_space(
391+
include={'classifier': ['decision_tree']})
392392
default = cs.get_default_configuration()
393393
cls = SimpleClassificationPipeline(default)
394394

@@ -420,24 +420,9 @@ def test_predict_batched(self):
420420

421421
def test_predict_batched_sparse(self):
422422
cs = SimpleClassificationPipeline.get_hyperparameter_search_space(
423+
include={'classifier': ['decision_tree']},
423424
dataset_properties={'sparse': True})
424-
config = Configuration(cs,
425-
values={"balancing:strategy": "none",
426-
"classifier:__choice__": "random_forest",
427-
"imputation:strategy": "mean",
428-
"one_hot_encoding:minimum_fraction": 0.01,
429-
"one_hot_encoding:use_minimum_fraction": "True",
430-
"preprocessor:__choice__": "no_preprocessing",
431-
'classifier:random_forest:bootstrap': 'True',
432-
'classifier:random_forest:criterion': 'gini',
433-
'classifier:random_forest:max_depth': 'None',
434-
'classifier:random_forest:min_samples_split': 2,
435-
'classifier:random_forest:min_samples_leaf': 2,
436-
'classifier:random_forest:max_features': 0.5,
437-
'classifier:random_forest:max_leaf_nodes': 'None',
438-
'classifier:random_forest:n_estimators': 100,
439-
'classifier:random_forest:min_weight_fraction_leaf': 0.0,
440-
"rescaling:__choice__": "min/max"})
425+
config = cs.get_default_configuration()
441426
cls = SimpleClassificationPipeline(config)
442427

443428
# Multiclass
@@ -469,7 +454,8 @@ def test_predict_batched_sparse(self):
469454
assert_array_almost_equal(prediction_, prediction)
470455

471456
def test_predict_proba_batched(self):
472-
cs = SimpleClassificationPipeline.get_hyperparameter_search_space()
457+
cs = SimpleClassificationPipeline.get_hyperparameter_search_space(
458+
include={'classifier': ['decision_tree']})
473459
default = cs.get_default_configuration()
474460

475461
# Multiclass
@@ -504,25 +490,10 @@ def test_predict_proba_batched(self):
504490

505491
def test_predict_proba_batched_sparse(self):
506492
cs = SimpleClassificationPipeline.get_hyperparameter_search_space(
493+
include={'classifier': ['decision_tree']},
507494
dataset_properties={'sparse': True})
508495

509-
config = Configuration(cs,
510-
values={"balancing:strategy": "none",
511-
"classifier:__choice__": "random_forest",
512-
"imputation:strategy": "mean",
513-
"one_hot_encoding:minimum_fraction": 0.01,
514-
"one_hot_encoding:use_minimum_fraction": 'True',
515-
"preprocessor:__choice__": "no_preprocessing",
516-
'classifier:random_forest:bootstrap': 'True',
517-
'classifier:random_forest:criterion': 'gini',
518-
'classifier:random_forest:max_depth': 'None',
519-
'classifier:random_forest:min_samples_split': 2,
520-
'classifier:random_forest:min_samples_leaf': 2,
521-
'classifier:random_forest:min_weight_fraction_leaf': 0.0,
522-
'classifier:random_forest:max_features': 0.5,
523-
'classifier:random_forest:max_leaf_nodes': 'None',
524-
'classifier:random_forest:n_estimators': 100,
525-
"rescaling:__choice__": "min/max"})
496+
config = cs.get_default_configuration()
526497

527498
# Multiclass
528499
cls = SimpleClassificationPipeline(config)

test/test_pipeline/test_regression.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@ def test_get_hyperparameter_search_space_dataset_properties(self):
370370
"""
371371

372372
def test_predict_batched(self):
373-
cs = SimpleRegressionPipeline.get_hyperparameter_search_space()
373+
cs = SimpleRegressionPipeline.get_hyperparameter_search_space(
374+
include={'regressor': ['decision_tree']})
374375
default = cs.get_default_configuration()
375376
cls = SimpleRegressionPipeline(default)
376377

@@ -387,7 +388,8 @@ def test_predict_batched(self):
387388

388389
def test_predict_batched_sparse(self):
389390
cs = SimpleRegressionPipeline.get_hyperparameter_search_space(
390-
dataset_properties={'sparse': True})
391+
dataset_properties={'sparse': True},
392+
include={'regressor': ['decision_tree']})
391393
default = cs.get_default_configuration()
392394
cls = SimpleRegressionPipeline(default)
393395

0 commit comments

Comments
 (0)