94 def __init__(self, identifier):
96 Load a method stored under the given identifier
97 @param identifier identifying the method
100 self.identifier = identifier
102 self.weightfile = basf2_mva.Weightfile.load(self.identifier)
104 self.general_options = basf2_mva.GeneralOptions()
105 self.general_options.load(self.weightfile.getXMLTree())
118 self.specific_options =
None
119 if self.general_options.m_method ==
"FastBDT":
120 self.specific_options = basf2_mva.FastBDTOptions()
121 elif self.general_options.m_method ==
"TMVAClassification":
122 self.specific_options = basf2_mva.TMVAOptionsClassification()
123 elif self.general_options.m_method ==
"TMVARegression":
124 self.specific_options = basf2_mva.TMVAOptionsRegression()
125 elif self.general_options.m_method ==
"FANN":
126 self.specific_options = basf2_mva.FANNOptions()
127 elif self.general_options.m_method ==
"Python":
128 self.specific_options = basf2_mva.PythonOptions()
129 elif self.general_options.m_method ==
"PDF":
130 self.specific_options = basf2_mva.PDFOptions()
131 elif self.general_options.m_method ==
"Combination":
132 self.specific_options = basf2_mva.CombinationOptions()
133 elif self.general_options.m_method ==
"Reweighter":
134 self.specific_options = basf2_mva.ReweighterOptions()
135 elif self.general_options.m_method ==
"Trivial":
136 self.specific_options = basf2_mva.TrivialOptions()
138 raise RuntimeError(
"Unknown method " + self.general_options.m_method)
140 self.specific_options.load(self.weightfile.getXMLTree())
142 variables = [str(v)
for v
in self.general_options.m_variables]
143 importances = self.weightfile.getFeatureImportance()
146 self.importances = {k: importances[k]
for k
in variables}
148 self.variables = list(sorted(variables, key=
lambda v: self.importances.get(v, 0.0)))
152 self.root_importances = {k: importances[k]
for k
in self.root_variables}
154 self.description = str(basf2_mva.info(self.identifier))
156 self.spectators = [str(v)
for v
in self.general_options.m_spectators]
std::string makeROOTCompatible(std::string str)
Remove special characters that ROOT dislikes in branch names, e.g.