Belle II Software  release-05-01-25
FastBDT.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Thomas Keck *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <mva/methods/FastBDT.h>
12 
13 #include <framework/logging/Logger.h>
14 #include <sstream>
15 #include <vector>
16 
17 // Template specialization to fix NAN sort bug of FastBDT in upto Version 3.2
18 #if FastBDT_VERSION_MAJOR <= 3 && FastBDT_VERSION_MINOR <= 2
19 namespace FastBDT {
20  template<>
21  bool compareIncludingNaN(float i, float j)
22  {
23  if (std::isnan(i)) {
24  if (std::isnan(j)) {
25  // If both are NAN i is NOT smaller
26  return false;
27  } else {
28  // In all other cases i is smaller
29  return true;
30  }
31  }
32  // If j is NaN the following line will return false,
33  // which is fine in our case.
34  return i < j;
35  }
36 }
37 #endif
38 
39 namespace Belle2 {
44  namespace MVA {
45  bool isValidSignal(const std::vector<bool>& Signals)
46  {
47  const auto first = Signals.front();
48  for (const auto& value : Signals) {
49  if (value != first)
50  return true;
51  }
52  return false;
53  }
54 
55  void FastBDTOptions::load(const boost::property_tree::ptree& pt)
56  {
57  int version = pt.get<int>("FastBDT_version");
58 #if FastBDT_VERSION_MAJOR >= 5
59  if (version != 1 and version != 2) {
60  B2ERROR("Unkown weightfile version " << std::to_string(version));
61  throw std::runtime_error("Unkown weightfile version " + std::to_string(version));
62  }
63 #else
64  if (version != 1) {
65  B2ERROR("Unkown weightfile version " << std::to_string(version));
66  throw std::runtime_error("Unkown weightfile version " + std::to_string(version));
67  }
68 #endif
69  m_nTrees = pt.get<int>("FastBDT_nTrees");
70  m_nCuts = pt.get<int>("FastBDT_nCuts");
71  m_nLevels = pt.get<int>("FastBDT_nLevels");
72  m_shrinkage = pt.get<double>("FastBDT_shrinkage");
73  m_randRatio = pt.get<double>("FastBDT_randRatio");
74 
75 #if FastBDT_VERSION_MAJOR >= 5
76  if (version > 1) {
77 
78  m_flatnessLoss = pt.get<double>("FastBDT_flatnessLoss");
79  m_sPlot = pt.get<bool>("FastBDT_sPlot");
80 
81  unsigned int numberOfIndividualNCuts = pt.get<unsigned int>("FastBDT_number_individual_nCuts", 0);
82  m_individual_nCuts.resize(numberOfIndividualNCuts);
83  for (unsigned int i = 0; i < numberOfIndividualNCuts; ++i) {
84  m_individual_nCuts[i] = pt.get<unsigned int>(std::string("FastBDT_individual_nCuts") + std::to_string(i));
85  }
86 
87  m_purityTransformation = pt.get<bool>("FastBDT_purityTransformation");
88  unsigned int numberOfIndividualPurityTransformation = pt.get<unsigned int>("FastBDT_number_individualPurityTransformation", 0);
89  m_individualPurityTransformation.resize(numberOfIndividualPurityTransformation);
90  for (unsigned int i = 0; i < numberOfIndividualPurityTransformation; ++i) {
91  m_individualPurityTransformation[i] = pt.get<bool>(std::string("FastBDT_individualPurityTransformation") + std::to_string(i));
92  }
93 
94  } else {
95  m_flatnessLoss = -1.0;
96  m_sPlot = false;
97  }
98 #endif
99  }
100 
101  void FastBDTOptions::save(boost::property_tree::ptree& pt) const
102  {
103 #if FastBDT_VERSION_MAJOR >= 5
104  pt.put("FastBDT_version", 2);
105 #else
106  pt.put("FastBDT_version", 1);
107 #endif
108  pt.put("FastBDT_nTrees", m_nTrees);
109  pt.put("FastBDT_nCuts", m_nCuts);
110  pt.put("FastBDT_nLevels", m_nLevels);
111  pt.put("FastBDT_shrinkage", m_shrinkage);
112  pt.put("FastBDT_randRatio", m_randRatio);
113 #if FastBDT_VERSION_MAJOR >= 5
114  pt.put("FastBDT_flatnessLoss", m_flatnessLoss);
115  pt.put("FastBDT_sPlot", m_sPlot);
116  pt.put("FastBDT_number_individual_nCuts", m_individual_nCuts.size());
117  for (unsigned int i = 0; i < m_individual_nCuts.size(); ++i) {
118  pt.put(std::string("FastBDT_individual_nCuts") + std::to_string(i), m_individual_nCuts[i]);
119  }
120  pt.put("FastBDT_purityTransformation", m_purityTransformation);
121  pt.put("FastBDT_number_individualPurityTransformation", m_individualPurityTransformation.size());
122  for (unsigned int i = 0; i < m_individualPurityTransformation.size(); ++i) {
123  pt.put(std::string("FastBDT_individualPurityTransformation") + std::to_string(i), m_individualPurityTransformation[i]);
124  }
125 #endif
126  }
127 
128  po::options_description FastBDTOptions::getDescription()
129  {
130  po::options_description description("FastBDT options");
131  description.add_options()
132  ("nTrees", po::value<unsigned int>(&m_nTrees), "Number of trees in the forest. Reasonable values are between 10 and 1000")
133  ("nLevels", po::value<unsigned int>(&m_nLevels)->notifier(check_bounds<unsigned int>(0, 20, "nLevels")),
134  "Depth d of trees. The last layer of the tree will contain 2^d bins. Maximum is 20. Resonable values are 2 and 6.")
135  ("shrinkage", po::value<double>(&m_shrinkage)->notifier(check_bounds<double>(0.0, 1.0, "shrinkage")),
136  "Shrinkage of the boosting algorithm. Reasonable values are between 0.01 and 1.0.")
137  ("nCutLevels", po::value<unsigned int>(&m_nCuts)->notifier(check_bounds<unsigned int>(0, 20, "nCutLevels")),
138  "Number of cut levels N per feature. 2^N Bins will be used per feature. Reasonable values are between 6 and 12.")
139 #if FastBDT_VERSION_MAJOR >= 5
140  ("individualNCutLevels", po::value<std::vector<unsigned int>>(&m_individual_nCuts)->multitoken()->notifier(
141  check_bounds_vector<unsigned int>(0, 20, "individualNCutLevels")),
142  "Number of cut levels N per feature. 2^N Bins will be used per feature. Reasonable values are between 6 and 12. One value per feature (including spectators) should be provided, if parameter is not set the global value specified by nCutLevels is used for all features.")
143  ("sPlot", po::value<bool>(&m_sPlot),
144  "Since in sPlot each event enters twice, this option modifies the sampling algorithm so that the matching signal and background events are selected together.")
145  ("flatnessLoss", po::value<double>(&m_flatnessLoss),
146  "Activate Flatness Loss, all spectator variables are assumed to be variables in which the signal and background efficiency should be flat. negative values deactivates flatness loss.")
147  ("purityTransformation", po::value<bool>(&m_purityTransformation),
148  "Activates purity transformation on all features: Add the purity transformed of all features in addition to the training. This will double the number of features and slow down the inference considerably")
149  ("individualPurityTransformation", po::value<std::vector<bool>>(&m_individualPurityTransformation)->multitoken(),
150  "Activates purity transformation for each feature: Vector of boolean values which decide if the purity transformed of the feature should be added in addition to this training.")
151 #endif
152  ("randRatio", po::value<double>(&m_randRatio)->notifier(check_bounds<double>(0.0, 1.0001, "randRatio")),
153  "Fraction of the data sampled each training iteration. Reasonable values are between 0.1 and 1.0.");
154  return description;
155  }
156 
157 
159  const FastBDTOptions& specific_options) : Teacher(general_options),
160  m_specific_options(specific_options) { }
161 
163  {
164 
165  unsigned int numberOfFeatures = training_data.getNumberOfFeatures();
166 #if FastBDT_VERSION_MAJOR >= 4
167  unsigned int numberOfSpectators = training_data.getNumberOfSpectators();
168 #else
169  // Deactivate support for spectators below version 4!
170  unsigned int numberOfSpectators = 0;
171 #endif
172 
173  // FastBDT Version 4 has a simplified interface with a sklearn style Classifier
174 #if FastBDT_VERSION_MAJOR >= 5
175  if (m_specific_options.m_individual_nCuts.size() != 0
176  and m_specific_options.m_individual_nCuts.size() != numberOfFeatures + numberOfSpectators) {
177  B2ERROR("You provided individual nCut values for each feature and spectator, but the total number of provided cuts is not same as as the total number of features and spectators.");
178  }
179 
180  std::vector<bool> individualPurityTransformation = m_specific_options.m_individualPurityTransformation;
181  if (m_specific_options.m_purityTransformation) {
182  if (individualPurityTransformation.size() == 0) {
183  for (unsigned int i = 0; i < numberOfFeatures; ++i) {
184  individualPurityTransformation.push_back(true);
185  }
186  }
187  }
188 
189  std::vector<unsigned int> individual_nCuts = m_specific_options.m_individual_nCuts;
190  if (individual_nCuts.size() == 0) {
191  for (unsigned int i = 0; i < numberOfFeatures + numberOfSpectators; ++i) {
192  individual_nCuts.push_back(m_specific_options.m_nCuts);
193  }
194  }
195 
196  FastBDT::Classifier classifier(m_specific_options.m_nTrees, m_specific_options.m_nLevels, individual_nCuts,
198  m_specific_options.m_sPlot, m_specific_options.m_flatnessLoss, individualPurityTransformation,
199  numberOfSpectators, true);
200 
201  std::vector<std::vector<float>> X(numberOfFeatures + numberOfSpectators);
202  const auto& y = training_data.getSignals();
203  if (not isValidSignal(y)) {
204  B2FATAL("The training data is not valid. It only contains one class instead of two.");
205  }
206  const auto& w = training_data.getWeights();
207  for (unsigned int i = 0; i < numberOfFeatures; ++i) {
208  X[i] = training_data.getFeature(i);
209  }
210  for (unsigned int i = 0; i < numberOfSpectators; ++i) {
211  X[i + numberOfFeatures] = training_data.getSpectator(i);
212  }
213  classifier.fit(X, y, w);
214 #else
215  const auto& y = training_data.getSignals();
216  if (not isValidSignal(y)) {
217  B2FATAL("The training data is not valid. It only contains one class instead of two.");
218  }
219  std::vector<FastBDT::FeatureBinning<float>> featureBinnings;
220  std::vector<unsigned int> nBinningLevels;
221  for (unsigned int iFeature = 0; iFeature < numberOfFeatures; ++iFeature) {
222  auto feature = training_data.getFeature(iFeature);
223 
224  unsigned int nCuts = m_specific_options.m_nCuts;
225 #if FastBDT_VERSION_MAJOR >= 3
226  featureBinnings.push_back(FastBDT::FeatureBinning<float>(nCuts, feature));
227 #else
228  featureBinnings.push_back(FastBDT::FeatureBinning<float>(nCuts, feature.begin(), feature.end()));
229 #endif
230  nBinningLevels.push_back(nCuts);
231  }
232 
233  for (unsigned int iSpectator = 0; iSpectator < numberOfSpectators; ++iSpectator) {
234  auto feature = training_data.getSpectator(iSpectator);
235 
236  unsigned int nCuts = m_specific_options.m_nCuts;
237 #if FastBDT_VERSION_MAJOR >= 3
238  featureBinnings.push_back(FastBDT::FeatureBinning<float>(nCuts, feature));
239 #else
240  featureBinnings.push_back(FastBDT::FeatureBinning<float>(nCuts, feature.begin(), feature.end()));
241 #endif
242  nBinningLevels.push_back(nCuts);
243  }
244 
245  unsigned int numberOfEvents = training_data.getNumberOfEvents();
246 
247 #if FastBDT_VERSION_MAJOR >= 4
248  FastBDT::EventSample eventSample(numberOfEvents, numberOfFeatures, numberOfSpectators, nBinningLevels);
249 #else
250  FastBDT::EventSample eventSample(numberOfEvents, numberOfFeatures, nBinningLevels);
251 #endif
252  std::vector<unsigned int> bins(numberOfFeatures + numberOfSpectators);
253  for (unsigned int iEvent = 0; iEvent < numberOfEvents; ++iEvent) {
254  training_data.loadEvent(iEvent);
255  for (unsigned int iFeature = 0; iFeature < numberOfFeatures + numberOfSpectators; ++iFeature) {
256  bins[iFeature] = featureBinnings[iFeature].ValueToBin(training_data.m_input[iFeature]);
257  }
258  for (unsigned int iSpectator = 0; iSpectator < numberOfSpectators; ++iSpectator) {
259  bins[iSpectator + numberOfFeatures] = featureBinnings[iSpectator + numberOfFeatures].ValueToBin(
260  training_data.m_spectators[iSpectator]);
261  }
262  eventSample.AddEvent(bins, training_data.m_weight, training_data.m_isSignal);
263  }
264 
267 #if FastBDT_VERSION_MAJOR >= 3
268  FastBDT::Forest<float> forest(dt.GetShrinkage(), dt.GetF0(), true);
269 #else
270  FastBDT::Forest forest(dt.GetShrinkage(), dt.GetF0());
271 #endif
272  for (auto t : dt.GetForest()) {
273 #if FastBDT_VERSION_MAJOR >= 3
274  auto tree = FastBDT::removeFeatureBinningTransformationFromTree(t, featureBinnings);
275  forest.AddTree(tree);
276 #else
277  forest.AddTree(t);
278 #endif
279  }
280 
281 #endif
282 
283 
284  Weightfile weightfile;
285  std::string custom_weightfile = weightfile.generateFileName();
286  std::fstream file(custom_weightfile, std::ios_base::out | std::ios_base::trunc);
287 
288 #if FastBDT_VERSION_MAJOR >= 5
289  file << classifier << std::endl;
290 #else
291 #if FastBDT_VERSION_MAJOR >= 3
292  file << forest << std::endl;
293 #else
294  file << featureBinnings << std::endl;
295  file << forest << std::endl;
296 #endif
297 #endif
298  file.close();
299 
300  weightfile.addOptions(m_general_options);
301  weightfile.addOptions(m_specific_options);
302  weightfile.addFile("FastBDT_Weightfile", custom_weightfile);
303  weightfile.addSignalFraction(training_data.getSignalFraction());
304 
305  std::map<std::string, float> importance;
306 #if FastBDT_VERSION_MAJOR >= 5
307  for (auto& pair : classifier.GetVariableRanking()) {
308  importance[m_general_options.m_variables[pair.first]] = pair.second;
309  }
310 #else
311  for (auto& pair : forest.GetVariableRanking()) {
312  importance[m_general_options.m_variables[pair.first]] = pair.second;
313  }
314 #endif
315  weightfile.addFeatureImportance(importance);
316 
317  return weightfile;
318 
319  }
320 
321  void FastBDTExpert::load(Weightfile& weightfile)
322  {
323 
324  std::string custom_weightfile = weightfile.generateFileName();
325  weightfile.getFile("FastBDT_Weightfile", custom_weightfile);
326  std::fstream file(custom_weightfile, std::ios_base::in);
327 
328  int version = weightfile.getElement<int>("FastBDT_version", 0);
329  B2DEBUG(100, "FastBDT Weightfile Version " << version);
330  if (version < 2) {
331 #if FastBDT_VERSION_MAJOR >= 3
332  std::stringstream s;
333  {
334  std::string t;
335  std::fstream file2(custom_weightfile, std::ios_base::in);
336  getline(file2, t);
337  s << t;
338  }
339  int dummy;
340  // Try to read to integers, if this is sucessfull we have a old weightfile with a Feature Binning before the Tree.
341  if (!(s >> dummy >> dummy)) {
342  B2DEBUG(100, "FastBDT: I read a new weightfile of FastBDT using the new FastBDT version 3. Everythings fine!");
343  // New format since version 3
344  m_expert_forest = FastBDT::readForestFromStream<float>(file);
345  } else {
346  B2INFO("FastBDT: I read an old weightfile of FastBDT using the new FastBDT version 3."
347  "I will convert your FastBDT on-the-fly to the new version."
348  "Retrain the classifier to get rid of this message");
349  // Old format before version 3
350  // We read in first the feature binnings and than rewrite the tree
351  std::vector<FastBDT::FeatureBinning<float>> feature_binnings;
352  file >> feature_binnings;
353  double F0;
354  file >> F0;
355  double shrinkage;
356  file >> shrinkage;
357  // This parameter was not available in the old version
358  bool transform2probability = true;
359  FastBDT::Forest<unsigned int> temp_forest(shrinkage, F0, transform2probability);
360  unsigned int size;
361  file >> size;
362  for (unsigned int i = 0; i < size; ++i) {
363  temp_forest.AddTree(FastBDT::readTreeFromStream<unsigned int>(file));
364  }
365 
366  FastBDT::Forest<float> cleaned_forest(temp_forest.GetShrinkage(), temp_forest.GetF0(), temp_forest.GetTransform2Probability());
367  for (auto& tree : temp_forest.GetForest()) {
368  cleaned_forest.AddTree(FastBDT::removeFeatureBinningTransformationFromTree(tree, feature_binnings));
369  }
370  m_expert_forest = cleaned_forest;
371  }
372 #else
373  B2INFO("FastBDT: I read an old weightfile of FastBDT using the old FastBDT version."
374  "I try to fix the weightfile first to avoid problems due to NaN and inf values."
375  "Consider to switch to the newer version of FastBDT (newer externals)");
376  // Check for nan or inf in file and replace with 0
377  std::stringstream s;
378  std::string t;
379  while (getline(file, t)) {
380  size_t f = 0;
381 
382  while ((f = t.find("inf", f)) != std::string::npos) {
383  t.replace(f, std::string("inf").length(), std::string("0.0"));
384  f += std::string("0.0").length();
385  B2WARNING("Found infinity in FastBDT weightfile, I replace it with 0 to prevent horrible crashes, this is fixed in the newer version");
386  }
387  f = 0;
388  while ((f = t.find("nan", f)) != std::string::npos) {
389  t.replace(f, std::string("nan").length(), std::string("0.0"));
390  f += std::string("0.0").length();
391  B2WARNING("Found nan in FastBDT weightfile, I replace it with 0 to prevent horrible crashes, this is fixed in the newer version");
392  }
393  s << t + '\n';
394  }
396  m_expert_forest = FastBDT::readForestFromStream(s);
397 #endif
398  }
399 #if FastBDT_VERSION_MAJOR >= 5
400  else {
401  m_use_simplified_interface = true;
402  m_classifier = FastBDT::Classifier(file);
403  }
404 #else
405  else {
406  B2ERROR("Unknown Version 2 of Weightfile, please use a more recent FastBDT version");
407  }
408 #endif
409  file.close();
410 
411  weightfile.getOptions(m_specific_options);
412  }
413 
414  std::vector<float> FastBDTExpert::apply(Dataset& test_data) const
415  {
416 
417  std::vector<float> probabilities(test_data.getNumberOfEvents());
418  for (unsigned int iEvent = 0; iEvent < test_data.getNumberOfEvents(); ++iEvent) {
419  test_data.loadEvent(iEvent);
420 #if FastBDT_VERSION_MAJOR >= 3
421 #if FastBDT_VERSION_MAJOR >= 5
422  if (m_use_simplified_interface)
423  probabilities[iEvent] = m_classifier.predict(test_data.m_input);
424  else
425  probabilities[iEvent] = m_expert_forest.Analyse(test_data.m_input);
426 #else
427  probabilities[iEvent] = m_expert_forest.Analyse(test_data.m_input);
428 #endif
429 #else
430  std::vector<unsigned int> bins(m_expert_feature_binning.size());
431  for (unsigned int iFeature = 0; iFeature < m_expert_feature_binning.size(); ++iFeature) {
432  bins[iFeature] = m_expert_feature_binning[iFeature].ValueToBin(test_data.m_input[iFeature]);
433  }
434  probabilities[iEvent] = m_expert_forest.Analyse(bins);
435 #endif
436  }
437 
438  return probabilities;
439 
440  }
441 
442  }
444 }
Belle2::MVA::FastBDTOptions
Options for the FANN MVA method.
Definition: FastBDT.h:55
Belle2::MVA::FastBDTTeacher::train
virtual Weightfile train(Dataset &training_data) const override
Train a mva method using the given dataset returning a Weightfile.
Definition: FastBDT.cc:162
Belle2::MVA::FastBDTOptions::load
virtual void load(const boost::property_tree::ptree &pt) override
Load mechanism to load Options from a xml tree.
Definition: FastBDT.cc:55
Belle2::MVA::Dataset
Abstract base class of all Datasets given to the MVA interface The current event can always be access...
Definition: Dataset.h:34
Belle2::MVA::Weightfile::addSignalFraction
void addSignalFraction(float signal_fraction)
Saves the signal fraction in the xml tree.
Definition: Weightfile.cc:104
Belle2::MVA::Weightfile::getOptions
void getOptions(Options &options) const
Fills an Option object from the xml tree.
Definition: Weightfile.cc:76
Belle2::MVA::FastBDTExpert::m_expert_forest
FastBDT::Forest m_expert_forest
Forest Expert.
Definition: FastBDT.h:148
Belle2::MVA::FastBDTOptions::save
virtual void save(boost::property_tree::ptree &pt) const override
Save mechanism to store Options in a xml tree.
Definition: FastBDT.cc:101
Belle2::MVA::Weightfile::addFile
void addFile(const std::string &identifier, const std::string &custom_weightfile)
Add a file (mostly a weightfile from a MVA library) to our Weightfile.
Definition: Weightfile.cc:124
Belle2::MVA::Weightfile
The Weightfile class serializes all information about a training into an xml tree.
Definition: Weightfile.h:40
Belle2::MVA::FastBDTOptions::getDescription
virtual po::options_description getDescription() override
Returns a program options description for all available options.
Definition: FastBDT.cc:128
Belle2::MVA::FastBDTExpert::apply
virtual std::vector< float > apply(Dataset &test_data) const override
Apply this expert onto a dataset.
Definition: FastBDT.cc:414
Belle2::MVA::FastBDTExpert::load
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Definition: FastBDT.cc:321
Belle2::MVA::FastBDTOptions::m_randRatio
double m_randRatio
Fraction of data to use in the stochastic training.
Definition: FastBDT.h:84
Belle2::MVA::Weightfile::addFeatureImportance
void addFeatureImportance(const std::map< std::string, float > &importance)
Add variable importance.
Definition: Weightfile.cc:81
Belle2::MVA::FastBDTExpert::m_specific_options
FastBDTOptions m_specific_options
Method specific options.
Definition: FastBDT.h:140
Belle2::MVA::Weightfile::getElement
T getElement(const std::string &identifier) const
Returns a stored element from the xml tree.
Definition: Weightfile.h:153
Belle2::MVA::FastBDTExpert::m_expert_feature_binning
std::vector< FastBDT::FeatureBinning< float > > m_expert_feature_binning
Forest feature binning.
Definition: FastBDT.h:149
Belle2::MVA::FastBDTOptions::m_nCuts
unsigned int m_nCuts
Number of cut Levels = log_2(Number of Cuts)
Definition: FastBDT.h:81
Belle2::MVA::Teacher::m_general_options
GeneralOptions m_general_options
GeneralOptions containing all shared options.
Definition: Teacher.h:51
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MVA::Teacher
Abstract base class of all Teachers Each MVA library has its own implementation of this class,...
Definition: Teacher.h:31
Belle2::MVA::FastBDTTeacher::m_specific_options
FastBDTOptions m_specific_options
Method specific options.
Definition: FastBDT.h:117
Belle2::MVA::Weightfile::addOptions
void addOptions(const Options &options)
Add an Option object to the xml tree.
Definition: Weightfile.cc:71
Belle2::MVA::FastBDTOptions::m_nTrees
unsigned int m_nTrees
Number of trees.
Definition: FastBDT.h:80
Belle2::MVA::GeneralOptions::m_variables
std::vector< std::string > m_variables
Vector of all variables (branch names) used in the training.
Definition: Options.h:88
Belle2::MVA::GeneralOptions
General options which are shared by all MVA trainings.
Definition: Options.h:64
Belle2::MVA::Weightfile::getFile
void getFile(const std::string &identifier, const std::string &custom_weightfile)
Creates a file from our weightfile (mostly this will be a weightfile of an MVA library)
Definition: Weightfile.cc:147
Belle2::MVA::FastBDTTeacher::FastBDTTeacher
FastBDTTeacher(const GeneralOptions &general_options, const FastBDTOptions &specific_options)
Constructs a new teacher using the GeneralOptions and specific options of this training.
Definition: FastBDT.cc:158
Belle2::MVA::FastBDTOptions::m_nLevels
unsigned int m_nLevels
Depth of tree.
Definition: FastBDT.h:82
Belle2::MVA::Weightfile::generateFileName
std::string generateFileName(const std::string &suffix="")
Returns a temporary filename with the given suffix.
Definition: Weightfile.cc:114
Belle2::MVA::FastBDTOptions::m_shrinkage
double m_shrinkage
Shrinkage during the boosting step.
Definition: FastBDT.h:83