-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsa_search.py
More file actions
31 lines (22 loc) · 812 Bytes
/
sa_search.py
File metadata and controls
31 lines (22 loc) · 812 Bytes
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
import os
from src.pci_crackdown import *
with open('data/output/training_data_tam_19890427.pkl' , 'rb') as f:
df_train = pickle.load(f)
with open('data/output/testing_data_tam_19890427.pkl' , 'rb') as f:
df_test = pickle.load(f)
if not os.path.exists('Results/models/best.model'):
tamhk = pci_crackdown()
tamhk.run(df_train, df_test)
tamhk.save('Results/models/best')
print(tamhk.loss)
tamhk = pci_crackdown.load('Results/models/best')
print(tamhk.loss)
## GPU could run out of memory and crash if period is large
sa = tamhk.sa(df_train, df_test, T=0.05, discount=0.05, bandwidth = 0.05, period = 10)
if sa is not None:
print('*************')
print('better model!')
print('*************')
sa.save('Results/models/best')
print(tamhk.loss)
print(sa.loss)