88 def __init__(self, identifier):
90 Load a method stored under the given identifier
91 @param identifier identifying the method
94 self.identifier = identifier
96 self.weightfile = basf2_mva.Weightfile.load(self.identifier)
98 self.general_options = basf2_mva.GeneralOptions()
99 self.general_options.load(self.weightfile.getXMLTree())
112 self.specific_options =
None
113 if self.general_options.m_method ==
"FastBDT":
114 self.specific_options = basf2_mva.FastBDTOptions()
115 elif self.general_options.m_method ==
"TMVAClassification":
116 self.specific_options = basf2_mva.TMVAOptionsClassification()
117 elif self.general_options.m_method ==
"TMVARegression":
118 self.specific_options = basf2_mva.TMVAOptionsRegression()
119 elif self.general_options.m_method ==
"FANN":
120 self.specific_options = basf2_mva.FANNOptions()
121 elif self.general_options.m_method ==
"Python":
122 self.specific_options = basf2_mva.PythonOptions()
123 elif self.general_options.m_method ==
"PDF":
124 self.specific_options = basf2_mva.PDFOptions()
125 elif self.general_options.m_method ==
"Combination":
126 self.specific_options = basf2_mva.CombinationOptions()
127 elif self.general_options.m_method ==
"Reweighter":
128 self.specific_options = basf2_mva.ReweighterOptions()
129 elif self.general_options.m_method ==
"Trivial":
130 self.specific_options = basf2_mva.TrivialOptions()
132 raise RuntimeError(
"Unkown method " + self.general_options.m_method)
134 self.specific_options.load(self.weightfile.getXMLTree())
136 variables = [str(v)
for v
in self.general_options.m_variables]
137 importances = self.weightfile.getFeatureImportance()
140 self.importances = {k: importances[k]
for k
in variables}
142 self.variables = list(sorted(variables, key=
lambda v: self.importances.get(v, 0.0)))
146 self.root_importances = {k: importances[k]
for k
in self.root_variables}
148 self.description = str(basf2_mva.info(self.identifier))
150 self.spectators = [str(v)
for v
in self.general_options.m_spectators]