Belle II Software  release-05-02-19
RegressionTeacher< BaseClassifierTeacher, RegressionClassifierOptions > Class Template Reference

Core class for the training of regression methods based on binary classifiers. More...

#include <Regression.h>

Inheritance diagram for RegressionTeacher< BaseClassifierTeacher, RegressionClassifierOptions >:
Collaboration diagram for RegressionTeacher< BaseClassifierTeacher, RegressionClassifierOptions >:

Public Member Functions

 RegressionTeacher (const GeneralOptions &general_options, const RegressionClassifierOptions &specific_options)
 Create a new teacher out of the general and the regression method specific options.
 
Weightfile train (Dataset &training_data) const override
 Call the train function. More...
 

Protected Attributes

GeneralOptions m_general_options
 GeneralOptions containing all shared options.
 

Private Attributes

RegressionClassifierOptions m_specific_options
 The method specific options.
 
BaseClassifierTeacher m_baseClassifierTeacher
 The teacher to use for training.
 

Detailed Description

template<class BaseClassifierTeacher, class RegressionClassifierOptions>
class Belle2::MVA::RegressionTeacher< BaseClassifierTeacher, RegressionClassifierOptions >

Core class for the training of regression methods based on binary classifiers.

The idea is as follows:

  • If you want to solve a regression task, you need to make sure your target is between 0 and 1 and is more or less equally distributed (this is your task)
  • The teacher will then train N binary classifiers, where N is given by the maximal bin number in the options.
  • Each binary classifier is trained on the same data, but as a (binary) target is using

    s >= (1/number of bins) * (bin number)

    for every bin in [1, number of bins). This means, the first method is able to decide if a target value is very low or not, the second if it is medium low or not ... and the last if it is very high or not. The expert answer to a new data sample is the averaged output of all classifiers, which is very high, if all classifiers think it has a high value (then the target value is probably high) and very small, if non of them thinks the target value is high.

The class is very generic and can be used with every binary classifier.

Template Parameters
BaseClassifierTeacherThe teacher of the base binary classifier
RegressionClassifierOptionsThe options of the classifier (probably inheriting from RegressionOptions)

Definition at line 149 of file Regression.h.

Member Function Documentation

◆ train()

Belle2::MVA::Weightfile train ( Dataset training_data) const
overridevirtual

Call the train function.

For each bin number in [1, number of bins) train a new classifier on the target

s >= (1/number of bins) * (bin number)

where s is the target variable of the dataset. By this, we end up with (number of bins) classifier, each trained on the same data but with different targets.

Implements Teacher.

Definition at line 247 of file Regression.h.

249 {
250  Weightfile weightfile;
251  weightfile.addOptions(m_general_options);
252  weightfile.addOptions(m_specific_options);
253 
254  for (unsigned int binNumber = 1; binNumber < m_specific_options.getMaximalBinNumber(); binNumber++) {
255  RegressionDataSet specificDataSet(m_general_options, &training_data,
256  1.0 / m_specific_options.getMaximalBinNumber() * binNumber);
257  Weightfile specificWeightFile = m_baseClassifierTeacher.train(specificDataSet);
258 
259  std::string file = weightfile.generateFileName();
260  Weightfile::saveToXMLFile(specificWeightFile, file);
261  weightfile.addFile("BaseClassifier_WeightFile_" + std::to_string(binNumber), file);
262  }
263  return weightfile;
264 }

The documentation for this class was generated from the following file:
Belle2::MVA::RegressionTeacher::m_baseClassifierTeacher
BaseClassifierTeacher m_baseClassifierTeacher
The teacher to use for training.
Definition: Regression.h:171
Belle2::MVA::Teacher::m_general_options
GeneralOptions m_general_options
GeneralOptions containing all shared options.
Definition: Teacher.h:51
Belle2::MVA::RegressionTeacher::m_specific_options
RegressionClassifierOptions m_specific_options
The method specific options.
Definition: Regression.h:169
Belle2::MVA::Weightfile::saveToXMLFile
static void saveToXMLFile(Weightfile &weightfile, const std::string &filename)
Static function which saves a Weightfile to a XML file.
Definition: Weightfile.cc:184