-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrainMVA.py
31 lines (26 loc) · 1006 Bytes
/
TrainMVA.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
import basf2_mva
go = basf2_mva.GeneralOptions()
go.m_datafiles = basf2_mva.vector('train.root')
go.m_treename = 'xicp'
go.m_identifier = 'weightfile.root'
go.m_variables = basf2_mva.vector("p_protonID_noSVD",
"K_kaonID_noSVD",
"Lambdac_y",
"Xic_alpha"
)
go.m_target_variable = 'Xic_isSignal'
go.m_method = "FastBDT"
sp = basf2_mva.FastBDTOptions()
#sp.m_nTrees = 600
#sp.m_shrinkage = 0.2
#sp.m_nCuts = 10
#sp.m_nLevels = 10
#sp.m_randRatio = 0.6
#sp.m_purityTransformation = 1
#sp = basf2_mva.TMVAOptionsClassification()
#sp.m_config = '!H:!V:CreateMVAPdfs:BoostType=Grad:NTrees=100:Shrinkage=0.2:MaxDepth=3'
basf2_mva.teacher(go, sp)
basf2_mva.expert(basf2_mva.vector('weightfile.root'),
basf2_mva.vector('train.root'), 'xicp', 'expert_train.root')
basf2_mva.expert(basf2_mva.vector('weightfile.root'),
basf2_mva.vector('test.root'), 'xicp', 'expert_test.root')