Belle II Software light-2406-ragdoll
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.
 

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 139 of file Regression.h.

Constructor & Destructor Documentation

◆ RegressionTeacher()

RegressionTeacher ( const GeneralOptions general_options,
const RegressionClassifierOptions &  specific_options 
)

Create a new teacher out of the general and the regression method specific options.

Definition at line 265 of file Regression.h.

267 :
268 Teacher(general_options), m_specific_options(specific_options),
269 m_baseClassifierTeacher(general_options, specific_options.getBaseClassifierOptions())
270{
271}
BaseClassifierTeacher m_baseClassifierTeacher
The teacher to use for training.
Definition: Regression.h:161
RegressionClassifierOptions m_specific_options
The method specific options.
Definition: Regression.h:159
Teacher(const GeneralOptions &general_options)
Constructs a new teacher using the GeneralOptions for this training.
Definition: Teacher.cc:18

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 245 of file Regression.h.

247{
248 Weightfile weightfile;
249 weightfile.addOptions(m_general_options);
250 weightfile.addOptions(m_specific_options);
251
252 for (unsigned int binNumber = 1; binNumber < m_specific_options.getMaximalBinNumber(); binNumber++) {
253 RegressionDataSet specificDataSet(m_general_options, &training_data,
254 1.0 / m_specific_options.getMaximalBinNumber() * binNumber);
255 Weightfile specificWeightFile = m_baseClassifierTeacher.train(specificDataSet);
256
257 std::string file = weightfile.generateFileName();
258 Weightfile::saveToXMLFile(specificWeightFile, file);
259 weightfile.addFile("BaseClassifier_WeightFile_" + std::to_string(binNumber), file);
260 }
261 return weightfile;
262}
GeneralOptions m_general_options
GeneralOptions containing all shared options.
Definition: Teacher.h:49
static void saveToXMLFile(Weightfile &weightfile, const std::string &filename)
Static function which saves a Weightfile to a XML file.
Definition: Weightfile.cc:175

Member Data Documentation

◆ m_baseClassifierTeacher

BaseClassifierTeacher m_baseClassifierTeacher
private

The teacher to use for training.

Definition at line 161 of file Regression.h.

◆ m_general_options

GeneralOptions m_general_options
protectedinherited

GeneralOptions containing all shared options.

Definition at line 49 of file Teacher.h.

◆ m_specific_options

RegressionClassifierOptions m_specific_options
private

The method specific options.

Definition at line 159 of file Regression.h.


The documentation for this class was generated from the following file: