-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_benchmark.py
More file actions
67 lines (59 loc) · 2.06 KB
/
run_benchmark.py
File metadata and controls
67 lines (59 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import openml
from sklearn.model_selection import StratifiedShuffleSplit, ShuffleSplit
from smac.facade.roar_facade import ROAR
from smac.facade.smac_hpo_facade import SMAC4HPO
from hyperbench.benchmark import BenchmarkConfig
from hyperbench.benchmark import BenchmarkRunner
from hyperbench.hyperboost import HyperboostEPM
from hyperbench.provider import OpenMLProvider
from hyperbench.optimizers import SMACBasedOptimizer
from hyperbench.target_algorithms import SVM, RandomForest, SGD, XGBoost
from hyperbench.transformer import SimpleTransformer
tasks = openml.study.get_suite(99).tasks
# These datasets take too long to evaluate on
excluded = [
# Dimensions are too high
167124, # CIFAR_10
167121, # Devnagari-Script
146825, # Fashion-MNIST
3573, # mnist_784
9910, # Bioresponse
14970, # har
167125, # Internet-Advertisements
3481, # isolet
9977, # nomao
146195, # connect-4
167120, # numerai28.6
9976, # madelon
9981, # cnae-9
6, # letter
# Too many rows for SVM classifier
7592, # adult
219, # electricity
14965, # bank-marketing
167119, # jungle_chess_2pcs_raw_endgame_complete
]
tasks = [task for task in tasks if task not in excluded]
benchmark = BenchmarkConfig(
budget=300,
time_based=False,
transformer=SimpleTransformer(),
output_folder="results",
scoring="balanced_accuracy",
seeds=[2268061101, 2519249986, 338403738],
target_algorithms=[RandomForest(), XGBoost(), SGD(), SVM()],
datasets=[OpenMLProvider(task) for task in tasks],
optimizers=[
SMACBasedOptimizer(ROAR, "roar", budget_multiplier=2),
SMACBasedOptimizer(SMAC4HPO, "smac", budget_multiplier=1),
SMACBasedOptimizer(SMAC4HPO, "hyperboost", budget_multiplier=1, model=HyperboostEPM)
],
search_eval_splits=StratifiedShuffleSplit(
n_splits=1, test_size=0.25, random_state=0
),
train_test_splits=ShuffleSplit(
n_splits=3, random_state=0, test_size=0.10
),
)
if __name__ == "__main__":
BenchmarkRunner(benchmark).start()