Belle II Software  release-05-02-19
FastBDTClassifierTrainingModule.h
1 /*************************************************************************
2 * BASF2 (Belle Analysis Framework 2) *
3 * Copyright(C) 2016 - Belle II Collaboration *
4 * *
5 * Author: The Belle II Collaboration *
6 * Contributors: Thomas Madlener *
7 * *
8 * This software is provided "as is" without any warranty. *
9 **************************************************************************/
10 
11 #pragma once
12 
13 #include <tracking/trackFindingVXD/filterTools/FBDTClassifierHelper.h> // for the FBDTTrainSample
14 #include <tracking/trackFindingVXD/segmentNetwork/DirectedNodeNetworkContainer.h>
15 
16 #include <tracking/spacePointCreation/SpacePoint.h>
17 
18 #include <framework/core/Module.h>
19 #include <framework/datastore/StoreObjPtr.h>
20 
21 #include <string>
22 #include <vector>
23 
24 namespace Belle2 {
40  class FastBDTClassifierTrainingModule : public Module {
41 
42  public:
43 
46 
48  void initialize() override;
49 
51  void event() override;
52 
54  void terminate() override;
55 
56  private:
57 
60 
62  std::string m_PARAMfbdtOutFileName;
63 
65  std::string m_PARAMnetworkInputName;
66 
68  std::string m_PARAMsamplesFileName;
69 
71  bool m_PARAMdoTrain;
72 
75 
77  bool m_PARAMuseSamples;
78 
80  int m_PARAMnTrees;
81 
83  int m_PARAMtreeDepth;
84 
86  double m_PARAMshrinkage;
87 
89  double m_PARAMrandRatio;
90 
92  std::vector<TrainSample> m_samples;
93 
96 
98  const TrainSample makeTrainSample(const Belle2::SpacePoint* outerHit, const Belle2::SpacePoint* centerHit,
99  const Belle2::SpacePoint* innerHit);
100  };
101 
103 } // end namespace Belle2
Belle2::FastBDTClassifierTrainingModule::m_PARAMfbdtOutFileName
std::string m_PARAMfbdtOutFileName
output file name into which the FBDTClassifier is stored.
Definition: FastBDTClassifierTrainingModule.h:70
Belle2::FastBDTClassifierTrainingModule::m_PARAMdoTrain
bool m_PARAMdoTrain
actually train a classifier or only do collection
Definition: FastBDTClassifierTrainingModule.h:79
Belle2::FBDTTrainSample
bundle together the classifier input and the target value into one struct for easier passing around.
Definition: FBDTClassifierHelper.h:36
Belle2::FastBDTClassifierTrainingModule::m_PARAMstoreSamples
bool m_PARAMstoreSamples
store the collected samples into a file
Definition: FastBDTClassifierTrainingModule.h:82
Belle2::FastBDTClassifierTrainingModule::m_samples
std::vector< TrainSample > m_samples
vector in which all samples are collected on the fly in event.
Definition: FastBDTClassifierTrainingModule.h:100
Belle2::FastBDTClassifierTrainingModule::m_PARAMshrinkage
double m_PARAMshrinkage
shrinkage parameter of FastBDT.
Definition: FastBDTClassifierTrainingModule.h:94
Belle2::FastBDTClassifierTrainingModule::FastBDTClassifierTrainingModule
FastBDTClassifierTrainingModule()
module constructor.
Definition: FastBDTClassifierTrainingModule.cc:29
Belle2::FastBDTClassifierTrainingModule::m_PARAMsamplesFileName
std::string m_PARAMsamplesFileName
filename to be used to store / read collect samples
Definition: FastBDTClassifierTrainingModule.h:76
Belle2::FastBDTClassifierTrainingModule::m_PARAMtreeDepth
int m_PARAMtreeDepth
tree depth in FastBDT.
Definition: FastBDTClassifierTrainingModule.h:91
Belle2::SpacePoint
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:52
Belle2::FastBDTClassifierTrainingModule::event
void event() override
collect all possible combinations and store them
Definition: FastBDTClassifierTrainingModule.cc:92
Belle2::FastBDTClassifierTrainingModule::terminate
void terminate() override
take the collected data and train a FBDTClassifier and store it in the given output file
Definition: FastBDTClassifierTrainingModule.cc:118
Belle2::FastBDTClassifierTrainingModule::m_network
Belle2::StoreObjPtr< Belle2::DirectedNodeNetworkContainer > m_network
StoreObjPtr to access the DNNs that are used in this module.
Definition: FastBDTClassifierTrainingModule.h:103
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr< Belle2::DirectedNodeNetworkContainer >
Belle2::FastBDTClassifierTrainingModule::m_PARAMnetworkInputName
std::string m_PARAMnetworkInputName
name of the StoreObjPtr in which the network container is stored which contains the network that is u...
Definition: FastBDTClassifierTrainingModule.h:73
Belle2::FastBDTClassifierTrainingModule::makeTrainSample
const TrainSample makeTrainSample(const Belle2::SpacePoint *outerHit, const Belle2::SpacePoint *centerHit, const Belle2::SpacePoint *innerHit)
create a trainings sample from the three hit combination
Definition: FastBDTClassifierTrainingModule.cc:143
Belle2::FastBDTClassifierTrainingModule::m_PARAMrandRatio
double m_PARAMrandRatio
ratio of samples to be used for training one tree in the FastBDT.
Definition: FastBDTClassifierTrainingModule.h:97
Belle2::FastBDTClassifierTrainingModule::initialize
void initialize() override
initialize the module
Definition: FastBDTClassifierTrainingModule.cc:53
Belle2::FastBDTClassifierTrainingModule::m_PARAMnTrees
int m_PARAMnTrees
number of trees in the FastBDT.
Definition: FastBDTClassifierTrainingModule.h:88
Belle2::FastBDTClassifierTrainingModule::m_PARAMuseSamples
bool m_PARAMuseSamples
use pre-collected samples for training and bypass the collection step
Definition: FastBDTClassifierTrainingModule.h:85