Skip to content

Commit 8425777

Browse files
henry-wallace-physHenry WallaceHenry WallaceHenry Wallace
authored
Hwallace/feature/automatic tuning (#28)
* Removes diagnostics library as it was unused * Remove unused files * More purging of plotting code * Remove even more stuff * More fixes to code grammar * More updates, adds implementation TF interface that automatically generates neural network * Bug fixes and automatica tuning fixes, now scales labels down to 0,1 * Lots of updates, basic SBI etc. --------- Co-authored-by: Henry Wallace <henryi@beluga2.int.ets1.calculquebec.ca> Co-authored-by: Henry Wallace <henryi@beluga1.int.ets1.calculquebec.ca> Co-authored-by: Henry Wallace <henryi@beluga4.int.ets1.calculquebec.ca>
1 parent 2df44d4 commit 8425777

37 files changed

+668
-1701
lines changed

configs/.small_network_tf.yml.swp

-12 KB
Binary file not shown.

configs/automated_tf.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
FileSettings:
2+
# FileName : "/home/henryi/sft/MaCh3Tutorial/Test.root"
3+
# FileName: "/home/henryi/scratch/Delayed_Fit_Long_Chains_no_delay_adapt_0_4.root"
4+
SkipFileLoading: True
5+
FileName: "/home/henryi/scratch/thinned_partial_chain.root"
6+
ChainName : "posteriors"
7+
Verbose : False
8+
MakeMLModel: True
9+
RunLLHScan: False
10+
RunMCMC: True
11+
12+
13+
ParameterSettings:
14+
ParameterNames : ["sin2th","delm2", "delta", "xsec", "sk", "nd"]
15+
LabelName : "LogL"
16+
IgnoredParameters : ["LogL_systematic_xsec_cov", "Log",
17+
"LogL_systematic_nddet_cov"]
18+
ParameterCuts : ["LogL<5000", "LogL>4900", "delm2_23>0"]
19+
CircularParameter: ["delta_cp"]
20+
21+
22+
MLSettings:
23+
FitterPackage : "TensorFlow"
24+
FitterName : "autotune"
25+
TestSize : 0.2
26+
27+
MLOutputFile: "tf_model_normal_order_small.keras"
28+
MLScalerOutputName: "scaler_tf_model_normal_order_small.pkl"
29+
30+
PlotOutputName : "tf_normal_order.pdf"
31+
32+
AddFromExternalModel: False
33+
ExternalModel: "tf_model_normal_order.keras"
34+
ExternalScaler: "scaler_tf_model_normal_order_small.pkl"
35+
36+
FitterKwargs:
37+
BuildSettings:
38+
epochs: 10000
39+
batch_size: 4096
40+
# Tuning features
41+
n_trials: 30
42+
43+
hyperband_iterations: 10
44+
tuning_dir: "~/scratch/t2k_full_tuning"
45+
project_name: "t2k_linear_tune"
46+
47+
n_layers: [5, 25, 2]
48+
activation: ['tanh', 'relu', 'swish', 'selu', 'elu', 'leak_relu', 'softplus']
49+
neurons_per_layer: [24, 1024, 100]
50+
learning_rate: [0.001, 0.0001, 0.00001]
51+
regularization: [0.0001, 0.1, 1.0]
52+
53+
MCMCSettings:
54+
NSteps: 1000000
55+
NChains: 20
56+
UpdateStep: 100
57+
MaxUpdateSteps: 500000
58+
59+
MCMCOutput: "/home/henryi/scratch/mcmc_chain_GPU.h5"
60+
61+
LikelihoodScanSettings:
62+
NDivisions: 10000

configs/big_network.yml

-103
This file was deleted.

configs/normalizing_flow.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
FileSettings:
2+
# FileName : "/home/henryi/sft/MaCh3Tutorial/Test.root"
3+
# FileName: "/home/henryi/scratch/Delayed_Fit_Long_Chains_no_delay_adapt_0_4.root"
4+
SkipFileLoading: True
5+
FileName: "/home/henryi/scratch/thinned_partial_chain.root"
6+
ChainName : "posteriors"
7+
Verbose : False
8+
MakeMLModel: True
9+
RunLLHScan: False
10+
RunMCMC: False
11+
12+
13+
ParameterSettings:
14+
ParameterNames : ["sin2th","delm2", "delta", "xsec", "sk", "nd"]
15+
LabelName : "LogL"
16+
IgnoredParameters : ["LogL_systematic_xsec_cov", "Log",
17+
"LogL_systematic_nddet_cov"]
18+
ParameterCuts : ["LogL<5000", "LogL>4900", "delm2_23>0"]
19+
CircularParameter: ["delta_cp"]
20+
21+
22+
MLSettings:
23+
FitterPackage : "TensorFlow"
24+
FitterName : "normalizing_flow"
25+
TestSize : 0.2
26+
27+
MLOutputFile: "tf_model_normal_order_small.keras"
28+
MLScalerOutputName: "scaler_tf_model_normal_order_small.pkl"
29+
30+
PlotOutputName : "tf_normal_order.pdf"
31+
32+
AddFromExternalModel: False
33+
ExternalModel: "tf_model_normal_order.keras"
34+
ExternalScaler: "scaler_tf_model_normal_order_small.pkl"
35+
36+
FitterKwargs:
37+
BuildSettings:
38+
learning_rate: 0.01
39+
hidden_units: [2000, 2000, 2000, 2000, 2000, 2000]
40+
loc: 0
41+
scale: 1
42+
43+
FitSettings:
44+
batch_size: 4096
45+
epochs: 250
46+
validation_split: 0.1
47+
shuffle: True
48+
steps_per_epoch: 1
49+
MCMCSettings:
50+
NSteps: 1000000
51+
NChains: 20
52+
UpdateStep: 100
53+
MaxUpdateSteps: 500000
54+
55+
MCMCOutput: "/home/henryi/scratch/mcmc_chain_GPU.h5"
56+
57+
LikelihoodScanSettings:
58+
NDivisions: 10000

configs/normalizing_flow_config.yml

-23
This file was deleted.

configs/plotting_config.yml

-50
This file was deleted.

0 commit comments

Comments
 (0)