PandaRoot
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...
 
- Public Member Functions inherited from PndMvaClassifier
 PndMvaClassifier (std::string const &InPut, std::vector< std::string > const &ClassNames, std::vector< std::string > const &VarNames)
 Constructor. More...
 
virtual ~PndMvaClassifier ()
 Destructor. 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...
 

Additional Inherited Members

- Protected Member Functions inherited from PndMvaClassifier
virtual void NormalizeEvent (std::vector< float > &EvtVector) const
 Normalize the given event vector. More...
 
void SetAppType (AppType t)
 
- Protected Attributes inherited from PndMvaClassifier
PndMvaDataSet m_dataSets
 Data set. Holds event Weights. More...
 

Detailed Description

!< Type definition of the neighbour list.

KNN based classification alg. implementation.

Definition at line 28 of file PndKnnClassify.h.

Constructor & Destructor Documentation

◆ PndKnnClassify()

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

Constructor.

Parameters
inputFileFile that holds the weights
classNamesClass names.
varNamesVariable names from which the feature vector is built.

Referenced by print().

◆ ~PndKnnClassify()

virtual PndKnnClassify::~PndKnnClassify ( )
virtual

Destructor.

Member Function Documentation

◆ Classify()

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.

◆ GetKnn()

size_t PndKnnClassify::GetKnn ( )
inline

Get the number of neighbours.

Definition at line 113 of file PndKnnClassify.h.

114 {
115  return m_knn;
116 };

◆ GetMvaValues()

void PndKnnClassify::GetMvaValues ( std::vector< float >  eventData,
std::map< std::string, float > &  result 
)
virtual

Classification function.

Parameters
eventDataFeature vector of the current event.
resultHolds the normalized results of classification

Implements PndMvaClassifier.

◆ Initialize()

virtual void PndKnnClassify::Initialize ( )
virtual

Initialize the needed internal and external data structures.

Reimplemented from PndMvaClassifier.

◆ print()

void PndKnnClassify::print ( )
inline

DEBUG Produces a lot of output.

Definition at line 73 of file PndKnnClassify.h.

References PndKnnClassify().

73 { m_module->Print(); }

◆ SetEvtParam()

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 102 of file PndKnnClassify.h.

103 {
104  m_ScaleFact = scFact;
105  m_weight = weight;
106 };

◆ SetKnn()

void PndKnnClassify::SetKnn ( size_t const  N)
inline

Set the number of neighbours.

Definition at line 108 of file PndKnnClassify.h.

109 {
110  m_knn = N;
111 };

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