16variables = [
'M',
'p',
'pt',
'pz',
17 'daughter(0, p)',
'daughter(0, pz)',
'daughter(0, pt)',
18 'daughter(1, p)',
'daughter(1, pz)',
'daughter(1, pt)',
19 'daughter(2, p)',
'daughter(2, pz)',
'daughter(2, pt)',
20 'chiProb',
'dr',
'dz',
21 'daughter(0, dr)',
'daughter(1, dr)',
22 'daughter(0, dz)',
'daughter(1, dz)',
23 'daughter(0, chiProb)',
'daughter(1, chiProb)',
'daughter(2, chiProb)',
24 'daughter(0, kaonID)',
'daughter(0, pionID)',
25 'daughterInvM(0, 1)',
'daughterInvM(0, 2)',
'daughterInvM(1, 2)']
35 assert abs(np.mean(X.mean(axis=0))) < 0.10,
'Normalization appears to have failed'
36 assert abs(np.mean(X.std(axis=0)) - 1) < 0.10,
'Normalization appears to have failed'
38 return np.require(p, dtype=np.float32, requirements=[
'A',
'W',
'C',
'O'])
41def partial_fit(state, X, S, y, w, epoch, batch):
43 Test partial_fit function
48print(
"Executed python script")
50if __name__ ==
"__main__":
54 train_file = basf2.find_file(
'mva/train_D0toKpipi.root',
'examples',
False)
55 test_file = basf2.find_file(
'mva/test_D0toKpipi.root',
'examples',
False)
59 general_options = basf2_mva.GeneralOptions()
60 general_options.m_datafiles = basf2_mva.vector(train_file)
61 general_options.m_treename =
"tree"
62 general_options.m_variables = basf2_mva.vector(*variables)
63 general_options.m_target_variable =
"isSignal"
64 general_options.m_identifier =
"Python.xml"
65 general_options.m_max_events = 1000
67 specific_options = basf2_mva.PythonOptions()
68 specific_options.m_training_fraction = 0.9
69 specific_options.m_nIterations = 1
70 specific_options.m_mini_batch_size = 0
71 specific_options.m_framework =
'test'
72 specific_options.m_steering_file =
'mva/tests/python_normalization.py'
73 specific_options.m_normalize =
True
77 basf2_mva.teacher(general_options, specific_options)
78 basf2_mva.expert(basf2_mva.vector(
"Python.xml"),
79 basf2_mva.vector(test_file),
'tree',
'expert.root')
def clean_working_directory()
def skip_test(reason, py_case=None)