FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
PndKnnClassify Class Reference

!< Type definition of the neighbour list. More...

#include <PndKnnClassify.h>

Inheritance diagram for PndKnnClassify:
PndMvaClassifier

Public Member Functions

 PndKnnClassify (std::string const &inputFile, std::vector< std::string > const &classNames, std::vector< std::string > const &varNames)
 
virtual ~PndKnnClassify ()
 Destructor. More...
 
void GetMvaValues (std::vector< float > eventData, std::map< std::string, float > &result)
 
std::string * Classify (std::vector< float > EvtData)
 
void SetEvtParam (float const scFact, double const weight)
 
void SetKnn (size_t const N)
 Set the number of neighbours. More...
 
size_t GetKnn ()
 Get the number of neighbours. More...
 
virtual void Initialize ()
 
void print ()
 DEBUG Produces a lot of output. More...
 
std::vector< PndMvaClass > const & GetClasses () const
 Get the list of available classes (labels). More...
 
std::vector< PndMvaVariable >
const & 
GetVariables () const
 Get the list of available variables. More...
 

Protected Member Functions

virtual void NormalizeEvent (std::vector< float > &EvtVector) const
 Normalize the given event vector. More...
 
void SetAppType (AppType t)
 

Protected Attributes

PndMvaDataSet m_dataSets
 Data set. Holds event Weights. More...
 

Private Types

typedef std::list< std::pair
< const TMVA::kNN::Node
< TMVA::kNN::Event > *, float > > 
ResList
 

Private Member Functions

 PndKnnClassify (PndKnnClassify const &other)
 DEBUG. More...
 
PndKnnClassifyoperator= (PndKnnClassify const &other)
 
void InitKNN ()
 Type definition for the neighbours list. More...
 

Private Attributes

size_t m_knn
 Number of required neighbours. More...
 
float m_ScaleFact
 Scalefactor Default = 0.8. More...
 
double m_weight
 Event weight. More...
 
TMVA::kNN::ModulekNN * m_module
 
std::map< std::string, size_t > m_classIndices
 

Detailed Description

!< Type definition of the neighbour list.

KNN based classification alg. implementation.

Definition at line 28 of file PndKnnClassify.h.

Member Typedef Documentation

typedef std::list< std::pair<const TMVA::kNN::Node<TMVA::kNN::Event>*, float> > PndKnnClassify::ResList
private

Definition at line 92 of file PndKnnClassify.h.

Constructor & Destructor Documentation

PndKnnClassify::PndKnnClassify ( std::string const &  inputFile,
std::vector< std::string > const &  classNames,
std::vector< std::string > const &  varNames 
)
explicit

Constructor.

Parameters
inputFile,:File that holds the weights
classNames,:Class names.
varNames,:Variable names from which the feature vector is built.
virtual PndKnnClassify::~PndKnnClassify ( )
virtual

Destructor.

PndKnnClassify::PndKnnClassify ( PndKnnClassify const &  other)
private

DEBUG.

Member Function Documentation

std::string* PndKnnClassify::Classify ( std::vector< float >  EvtData)
virtual

Given a feature vector describing the pattern. Classifies the pattern.

Parameters
EvtDataInput vector describing the pattern.
Returns
The name of the class to which the current pattern is assigned.

Implements PndMvaClassifier.

std::vector< PndMvaClass > const & PndMvaClassifier::GetClasses ( ) const
inlineinherited

Get the list of available classes (labels).

Definition at line 90 of file PndMvaClassifier.h.

References PndMvaDataSet::GetClasses(), and PndMvaClassifier::m_dataSets.

91 {
92  return m_dataSets.GetClasses();
93 };
PndMvaDataSet m_dataSets
Data set. Holds event Weights.
std::vector< PndMvaClass > const & GetClasses() const
Get the list of available classes (labels).
size_t PndKnnClassify::GetKnn ( )
inline

Get the number of neighbours.

Definition at line 117 of file PndKnnClassify.h.

References m_knn.

118 {
119  return m_knn;
120 };
size_t m_knn
Number of required neighbours.
void PndKnnClassify::GetMvaValues ( std::vector< float >  eventData,
std::map< std::string, float > &  result 
)
virtual

Classification function.

Parameters
eventData,:Feature vector of the current event.
result,:Holds the normalized results of classification

Implements PndMvaClassifier.

std::vector< PndMvaVariable > const & PndMvaClassifier::GetVariables ( ) const
inlineinherited

Get the list of available variables.

Definition at line 96 of file PndMvaClassifier.h.

References PndMvaDataSet::GetVars(), and PndMvaClassifier::m_dataSets.

97 {
98  return m_dataSets.GetVars();
99 };
PndMvaDataSet m_dataSets
Data set. Holds event Weights.
std::vector< PndMvaVariable > const & GetVars() const
Get the list of available variables.
virtual void PndKnnClassify::Initialize ( )
virtual

Initialize the needed internal and external data structures.

Reimplemented from PndMvaClassifier.

Referenced by PndPidMvaAssociatorTask::Init().

void PndKnnClassify::InitKNN ( )
private

Type definition for the neighbours list.

Initialize the KNN classifier.

virtual void PndMvaClassifier::NormalizeEvent ( std::vector< float > &  EvtVector) const
protectedvirtualinherited

Normalize the given event vector.

PndKnnClassify& PndKnnClassify::operator= ( PndKnnClassify const &  other)
private
void PndKnnClassify::print ( )
inline

DEBUG Produces a lot of output.

Definition at line 77 of file PndKnnClassify.h.

References m_module.

77 {m_module->Print();}
TMVA::kNN::ModulekNN * m_module
void PndMvaClassifier::SetAppType ( AppType  t)
inlineprotectedinherited

Definition at line 83 of file PndMvaClassifier.h.

References PndMvaClassifier::m_dataSets, and PndMvaDataSet::SetAppType().

84 {
86 };
void SetAppType(AppType t)
PndMvaDataSet m_dataSets
Data set. Holds event Weights.
TTree * t
Definition: bump_analys.C:13
void PndKnnClassify::SetEvtParam ( float const  scFact,
double const  weight 
)
inline

Set the scalefactor and the event weight for KNN classifier.

Parameters
scFactScale factor.
weightEvents weight.

Definition at line 106 of file PndKnnClassify.h.

References m_ScaleFact, and m_weight.

Referenced by PndPidMvaAssociatorTask::Init().

107 {
108  m_ScaleFact = scFact;
109  m_weight = weight;
110 };
float m_ScaleFact
Scalefactor Default = 0.8.
double m_weight
Event weight.
void PndKnnClassify::SetKnn ( size_t const  N)
inline

Set the number of neighbours.

Definition at line 112 of file PndKnnClassify.h.

References m_knn.

Referenced by PndPidMvaAssociatorTask::Init().

113 {
114  m_knn = N;
115 };
size_t m_knn
Number of required neighbours.

Member Data Documentation

std::map<std::string, size_t> PndKnnClassify::m_classIndices
private

Mapping between class names and their indices in the class vector.

Definition at line 102 of file PndKnnClassify.h.

PndMvaDataSet PndMvaClassifier::m_dataSets
protectedinherited

Data set. Holds event Weights.

Definition at line 75 of file PndMvaClassifier.h.

Referenced by PndMvaClassifier::GetClasses(), PndMvaClassifier::GetVariables(), and PndMvaClassifier::SetAppType().

size_t PndKnnClassify::m_knn
private

Number of required neighbours.

Definition at line 94 of file PndKnnClassify.h.

Referenced by GetKnn(), and SetKnn().

TMVA::kNN::ModulekNN* PndKnnClassify::m_module
private

Definition at line 97 of file PndKnnClassify.h.

Referenced by print().

float PndKnnClassify::m_ScaleFact
private

Scalefactor Default = 0.8.

Definition at line 95 of file PndKnnClassify.h.

Referenced by SetEvtParam().

double PndKnnClassify::m_weight
private

Event weight.

Definition at line 96 of file PndKnnClassify.h.

Referenced by SetEvtParam().


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