 |
Belle II Software
release-05-02-19
|
13 #include <framework/datastore/RelationsObject.h>
16 #include <tracking/trackFindingVXD/filterTools/FBDTClassifierHelper.h>
17 #include <tracking/trackFindingVXD/filterTools/DecorrelationMatrix.h>
22 #if FastBDT_VERSION_MAJOR >= 3
23 typedef FastBDT::Forest<unsigned int> FBDTForest;
25 typedef FastBDT::Forest FBDTForest;
42 template<
size_t Ndims = 9>
50 FBDTClassifier(
const FBDTForest& forest,
const std::vector<FastBDT::FeatureBinning<double> >& fB,
56 double analyze(
const std::array<double, Ndims>& hits)
const;
63 int nTree,
int depth,
double shrinkage = 0.15,
double ratio = 0.5);
88 std::vector<FastBDT::FeatureBinning<double> >
m_featBins{};
101 template<
size_t Ndims>
104 std::vector<double> positions = m_decorrMat.decorrelate(hits);
106 std::vector<unsigned> bins(Ndims);
107 for (
size_t i = 0; i < Ndims; ++i) {
108 bins[i] = m_featBins[i].ValueToBin(positions[i]);
111 return m_forest.Analyse(bins);
ClassDef(FBDTClassifier, 2)
Making this Class a ROOT class.
FBDTForest m_forest
the forest used for classification
double analyze(const std::array< double, Ndims > &hits) const
calculate the output of the FastBDT.
Belle2::DecorrelationMatrix< Ndims > m_decorrMat
the decorrelation matrix used in this classifier
bundle together the classifier input and the target value into one struct for easier passing around.
std::vector< FastBDT::FeatureBinning< double > > getFeatureBinnings() const
get the feature binnings
FBDTClassifier(const FBDTForest &forest, const std::vector< FastBDT::FeatureBinning< double > > &fB, const Belle2::DecorrelationMatrix< 9 > &dM)
constructor from three main parts.
void readFromStream(std::istream &is)
read all the necessary data from stream and fill the Forest and the FeatureBinnings NOTE: uses FastBD...
Abstract base class for different kinds of events.
FBDTForest getForest() const
get the forest
void train(const std::vector< Belle2::FBDTTrainSample< Ndims > > &samples, int nTree, int depth, double shrinkage=0.15, double ratio=0.5)
train the BDT NOTE overwrites a currently existing classifier internally TODO does not work at the mo...
Belle2::DecorrelationMatrix< 9 > getDecorrelationMatrix() const
get the decorrelation matrix
void writeToStream(std::ostream &os) const
write out the data from the Forest and the FeatureBinnings to a stream NOTE: uses FastBDTs IO stuff.
FastBDT as RelationsObject to make it storeable and accesible on/via the DataStore.
std::vector< FastBDT::FeatureBinning< double > > m_featBins
the feature binnings corresponding to the BDT
Defines interface for accessing relations of objects in StoreArray.