11 #include <framework/datastore/RelationsObject.h>
14 #include <tracking/trackFindingVXD/filterTools/FBDTClassifierHelper.h>
15 #include <tracking/trackFindingVXD/filterTools/DecorrelationMatrix.h>
20 #if FastBDT_VERSION_MAJOR >= 3
21 typedef FastBDT::Forest<unsigned int> FBDTForest;
23 typedef FastBDT::Forest FBDTForest;
40 template<
size_t Ndims = 9>
48 FBDTClassifier(
const FBDTForest& forest,
const std::vector<FastBDT::FeatureBinning<double> >& fB,
54 double analyze(
const std::array<double, Ndims>& hits)
const;
61 int nTree,
int depth,
double shrinkage = 0.15,
double ratio = 0.5);
86 std::vector<FastBDT::FeatureBinning<double> >
m_featBins{};
99 template<
size_t Ndims>
102 std::vector<double> positions = m_decorrMat.decorrelate(hits);
104 std::vector<unsigned> bins(Ndims);
105 for (
size_t i = 0; i < Ndims; ++i) {
106 bins[i] = m_featBins[i].ValueToBin(positions[i]);
109 return m_forest.Analyse(bins);
FastBDT as RelationsObject to make it storeable and accesible on/via the DataStore.
FBDTForest m_forest
the forest used for classification
void readFromStream(std::istream &is)
read all the necessary data from stream and fill the Forest and the FeatureBinnings NOTE: uses FastBD...
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.
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...
std::vector< FastBDT::FeatureBinning< double > > getFeatureBinnings() const
get the feature binnings
ClassDef(FBDTClassifier, 2)
Making this Class a ROOT class.
FBDTClassifier(const FBDTForest &forest, const std::vector< FastBDT::FeatureBinning< double > > &fB, const Belle2::DecorrelationMatrix< 9 > &dM)
constructor from three main parts.
std::vector< FastBDT::FeatureBinning< double > > m_featBins
the feature binnings corresponding to the BDT
~FBDTClassifier()
TODO destructor.
Belle2::DecorrelationMatrix< Ndims > m_decorrMat
the decorrelation matrix used in this classifier
Defines interface for accessing relations of objects in StoreArray.
double analyze(const std::array< double, Ndims > &hits) const
calculate the output of the FastBDT.
Abstract base class for different kinds of events.
bundle together the classifier input and the target value into one struct for easier passing around.