Skip to content

Commit dae8bf0

Browse files
author
Julian Kates-Harbeck
committed
added option for partial multiplication factor in bleed in
1 parent ec4ed03 commit dae8bf0

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

examples/conf.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ paths:
1010
signal_prepath: '/signal_data/' #/signal_data/jet/
1111
shot_list_dir: '/shot_lists/'
1212
tensorboard_save_path: '/Graph/'
13-
data: jet_data #'d3d_to_jet_data' #'d3d_to_jet_data' # 'jet_to_d3d_data' #jet_data
13+
data: jet_to_d3d_data #'d3d_to_jet_data' #'d3d_to_jet_data' # 'jet_to_d3d_data' #jet_data
1414
specific_signals: [] #['q95','li','ip','betan','energy','lm','pradcore','pradedge','pradtot','pin','torquein','tmamp1','tmamp2','tmfreq1','tmfreq2','pechin','energydt','ipdirect','etemp_profile','edens_profile'] #if left empty will use all valid signals defined on a machine. Only use if need a custom set
1515
executable: "mpi_learn.py"
1616
shallow_executable: "learn.py"
1717

1818
data:
19-
bleed_in: 0 #how many shots from the test sit to use in training?
19+
bleed_in: 5 #how many shots from the test sit to use in training?
20+
bleed_in_repeat_fac: 10
2021
bleed_in_remove_from_test: True
21-
bleed_in_equalize_sets: True
22+
bleed_in_equalize_sets: False
2223
signal_to_augment: None #'plasma current' #or None
2324
augmentation_mode: 'none'
2425
augment_during_training: False
@@ -52,10 +53,10 @@ data:
5253
floatx: 'float32'
5354

5455
model:
55-
shallow: False
56+
shallow: True
5657
shallow_model:
5758
num_samples: 1000000 #1000000 #the number of samples to use for training
58-
type: "mlp" #"xgboost" #"xgboost" #"random_forest" "xgboost"
59+
type: "xgboost" #"xgboost" #"xgboost" #"random_forest" "xgboost"
5960
n_estimators: 100 #for random forest
6061
max_depth: 3 #for random forest and xgboost (def = 3)
6162
C: 1.0 #for svm
@@ -89,8 +90,8 @@ model:
8990
#have not found a difference yet
9091
optimizer: 'adam'
9192
clipnorm: 10.0
92-
regularization: 0.0
93-
dense_regularization: 0.01
93+
regularization: 0.001
94+
dense_regularization: 0.001
9495
#1e-4 is too high, 5e-7 is too low. 5e-5 seems best at 256 batch size, full dataset and ~10 epochs, and lr decay of 0.90. 1e-4 also works well if we decay a lot (i.e ~0.7 or more)
9596
lr: 0.00002 #0.00001 #0.0005 #for adam plots 0.0000001 #0.00005 #0.00005 #0.00005
9697
lr_decay: 0.97 #0.98 #0.9

plasma/preprocessor/preprocess.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def save_shotlists(self,shot_list_train,shot_list_validate,shot_list_test):
146146

147147

148148
def apply_bleed_in(conf,shot_list_train,shot_list_validate,shot_list_test):
149-
np.random.seed(1)
149+
np.random.seed(2)
150150
num = conf['data']['bleed_in']
151151
new_shots = []
152152
if num > 0:
@@ -170,13 +170,22 @@ def apply_bleed_in(conf,shot_list_train,shot_list_validate,shot_list_test):
170170
print("Sampled {} shots, {} disruptive, {} nondisruptive".format(num_sampled_nd+num_sampled_d,num_sampled_d,num_sampled_nd))
171171
print("Before adding: training shots: {} validation shots: {}".format(len(shot_list_train),len(shot_list_validate)))
172172
assert(num_sampled_d == num)
173-
num_to_sample = len(shot_list_bleed)
174173
if conf['data']['bleed_in_equalize_sets']:#add bleed-in shots to training and validation set repeatedly
174+
print("Applying equalized bleed in")
175175
for shot_list_curr in [shot_list_train,shot_list_validate]:
176176
for i in range(len(shot_list_curr)):
177177
s = shot_list_bleed.sample_shot()
178178
shot_list_curr.append(s)
179+
elif conf['data']['bleed_in_repeat_fac'] > 1:
180+
repeat_fac = conf['data']['bleed_in_repeat_fac']
181+
print("Applying bleed in with repeat factor {}".format(repeat_fac))
182+
num_to_sample = int(round(repeat_fac*len(shot_list_bleed)))
183+
for i in range(num_to_sample):
184+
s = shot_list_bleed.sample_shot()
185+
shot_list_train.append(s)
186+
shot_list_validate.append(s)
179187
else: #add each shot only once
188+
print("Applying bleed in without repetition")
180189
for s in shot_list_bleed:
181190
shot_list_train.append(s)
182191
shot_list_validate.append(s)

0 commit comments

Comments
 (0)