-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_tpot.py
42 lines (32 loc) · 1.15 KB
/
run_tpot.py
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
import datetime
from tpot import TPOTClassifier
from benchmark import OpenMLBenchmark
timeout = 3600 # in seconds
run_timeout = 360
jobs = 4
def main(bm: OpenMLBenchmark):
X_train = bm.X_train
y_train = bm.y_train
X_test = bm.X_test
y_test = bm.y_test
pipeline_optimizer = TPOTClassifier(
max_time_mins=timeout / 60,
max_eval_time_mins=run_timeout / 60,
scoring='accuracy',
n_jobs=jobs,
verbosity=2
)
pipeline_optimizer.fit(X_train, y_train)
print(pipeline_optimizer.fitted_pipeline_)
print('Misclassification Rate', 1 - pipeline_optimizer.score(X_test, y_test))
if __name__ == '__main__':
for i in range(4):
print('#######\nIteration {}\n#######'.format(i))
print('Timeout: ', timeout)
print('Run Timeout: ', run_timeout)
task_ids = [15, 23, 24, 29, 3021, 41, 2079, 3543, 3560, 3561,
3904, 3946, 9955, 9985, 7592, 14969, 14968, 14967, 125920, 146606]
for task in task_ids:
print('Starting task {} at {}'.format(task, datetime.datetime.now().time()))
bm = OpenMLBenchmark(task)
main(bm)