Interface definition for LVQ trainers.
More...
#include <PndLVQTrain.h>
|
| PndLVQTrain (std::vector< std::pair< std::string, std::vector< float > * > > const &InputEvtsParam, std::vector< std::string > const &ClassNames, std::vector< std::string > const &VarNames, bool trim=false) |
|
| PndLVQTrain (std::string const &InPut, std::vector< std::string > const &ClassNames, std::vector< std::string > const &VarNames, bool trim=true) |
|
virtual | ~PndLVQTrain () |
|
void | storeWeights () |
|
void | Train () |
|
void | Train21 () |
|
void | setProtoInitType (ProtoInitType iniTypeVal=RAND_FROM_DATA) |
|
void | SetInitProtoFileName (std::string const &fileName) |
|
void | SetLearnPrameters (double const initConst, double const etZ, double const etF, unsigned int const Nswp) |
|
void | SetNumberOfProto (size_t const numProto) |
|
void | SetNumberOfProto (std::map< std::string, size_t > const &labelMap) |
|
void | SetErrorStepSize (unsigned int const val=1000) |
|
void | SetLVQ2_1WindowSize (float const Wsize=0.3) |
|
void | EvalClassifierError () |
|
void | SetPerEpochEval (bool val) |
|
bool | GetPerEpochEval () const |
|
void | SetTestSetSize (size_t percent=50) |
|
void | SetTestSet (std::set< size_t > const &testSet) |
|
void | NormalizeData (NormType t=NONORM) |
|
void | PCATransForm () |
|
void | SetOutPutFile (std::string const &outFile) |
|
void | WriteErroVect (std::string const &FileName) const |
|
std::vector< StepError > const & | GetErrorValues () const |
|
virtual void | Initialize () |
|
std::set< size_t > const & | GetTestEvetIdx () const |
|
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...
|
|
size_t | GetRndSeed () const |
|
void | SetRndSeed (size_t const sd) |
|
Interface definition for LVQ trainers.
Definition at line 33 of file PndLVQTrain.h.
PndLVQTrain::PndLVQTrain |
( |
std::vector< std::pair< std::string, std::vector< float > * > > const & |
InputEvtsParam, |
|
|
std::vector< std::string > const & |
ClassNames, |
|
|
std::vector< std::string > const & |
VarNames, |
|
|
bool |
trim = false |
|
) |
| |
|
explicit |
Constructor:
- Parameters
-
InputEvtsParam | Input events vector. |
ClassNames | class names. |
VarNames | variable names of the features. |
PndLVQTrain::PndLVQTrain |
( |
std::string const & |
InPut, |
|
|
std::vector< std::string > const & |
ClassNames, |
|
|
std::vector< std::string > const & |
VarNames, |
|
|
bool |
trim = true |
|
) |
| |
|
explicit |
Constructor:
- Parameters
-
InPut | Input file name. |
ClassNames | class names. |
VarNames | variable names of the features. |
virtual PndLVQTrain::~PndLVQTrain |
( |
| ) |
|
|
virtual |
void PndLVQTrain::cleanProtoList |
( |
| ) |
|
|
private |
Clean prototype container.
void PndLVQTrain::EvalClassifierError |
( |
| ) |
|
|
virtual |
void PndLVQTrain::EvalClassifierError |
( |
unsigned int |
stp | ) |
|
|
private |
Evaluate the classifier, train and test error.
std::vector< PndMvaClass > const & PndMvaTrainer::GetClasses |
( |
| ) |
const |
|
inlineinherited |
Get the list of available classes (labels).
Get the list of available classes (labels). Vector containing available labels.
Definition at line 226 of file PndMvaTrainer.h.
References PndMvaDataSet::GetClasses(), and PndMvaTrainer::m_dataSets.
PndMvaDataSet m_dataSets
Data set. Holds event values.
std::vector< PndMvaClass > const & GetClasses() const
Get the list of available classes (labels).
std::vector< StepError > const & PndMvaTrainer::GetErrorValues |
( |
| ) |
const |
|
inlineinherited |
Get the list of objects that contain the classifier evaluation results.
- Returns
- List of evaluation objects.
Definition at line 238 of file PndMvaTrainer.h.
References PndMvaTrainer::m_StepErro.
std::vector< StepError > m_StepErro
Container to keep per step error values.
bool PndLVQTrain::GetPerEpochEval |
( |
| ) |
const |
|
inline |
Getter for evaluation scheme.
- Returns
- Per epoch or per step.
Definition at line 309 of file PndLVQTrain.h.
References m_PerEpoch.
bool m_PerEpoch
If evaluate per epoch.
size_t PndMvaTrainer::GetRndSeed |
( |
| ) |
const |
|
inlineinherited |
std::set< size_t > const & PndMvaTrainer::GetTestEvetIdx |
( |
| ) |
const |
|
inlineinherited |
Get the indices of the events selected to be used for testing.
- Returns
- A set containing the indices of test events.
Definition at line 220 of file PndMvaTrainer.h.
References PndMvaTrainer::m_testSet_indices.
std::set< size_t > m_testSet_indices
Indices of the test set.
std::vector< PndMvaVariable > const & PndMvaTrainer::GetVariables |
( |
| ) |
const |
|
inlineinherited |
Get the list of available variables.
Get the list of available variables. Vector containing available Parameters (features).
Definition at line 232 of file PndMvaTrainer.h.
References PndMvaDataSet::GetVars(), and PndMvaTrainer::m_dataSets.
PndMvaDataSet m_dataSets
Data set. Holds event values.
std::vector< PndMvaVariable > const & GetVars() const
Get the list of available variables.
virtual void PndMvaTrainer::Initialize |
( |
| ) |
|
|
virtualinherited |
void PndLVQTrain::InitProtoK_Means |
( |
| ) |
|
|
private |
Initialize LVQ prototypes (Code books) using K-Means clustering.
void PndLVQTrain::InitProtoRand |
( |
| ) |
|
|
private |
Initialize LVQ prototypes (Code books) using class conditional means (CCM) vectors.
void PndLVQTrain::InitProtoTypes |
( |
| ) |
|
|
private |
Initialize LVQ prototypes (Code books).
void PndLVQTrain::InitRandProtoFromData |
( |
| ) |
|
|
private |
Initialize LVQ prototypes (Code books) using Randomly selected vectors from the original data set.
Select input data normalization scheme.
void PndMvaTrainer::PCATransForm |
( |
| ) |
|
|
inherited |
Parameter decorrelation. Performs PCA (Principal component analysis) on the input dataset.
void PndLVQTrain::ReadProtoFromFile |
( |
| ) |
|
|
private |
Read pre-initialized code books from file and store the vectors in LVQ prototype container.
void PndMvaTrainer::SetAppType |
( |
AppType |
t | ) |
|
|
inlineprotectedinherited |
void PndLVQTrain::SetErrorStepSize |
( |
unsigned int const |
val = 1000 | ) |
|
|
inline |
Set how often the classifier has to be evaluated.
- Parameters
-
val | Evaluate after val steps. If (Val == 0) then the classifier is evaluated once at the end of the training prodecure. |
Definition at line 294 of file PndLVQTrain.h.
References m_ErrorStep, and val.
Double_t val[nBoxes][nFEBox]
unsigned int m_ErrorStep
Each #ErrorStep, steps evaluate the trained classifier.
void PndLVQTrain::SetInitProtoFileName |
( |
std::string const & |
fileName | ) |
|
|
inline |
Set the file name which holds the pre-initialized code books.
- Parameters
-
val | The name of the file which containes the pre initialized code books. |
Definition at line 280 of file PndLVQTrain.h.
References m_initProtoFile.
std::string m_initProtoFile
initial protypes, when reading from file.
void PndLVQTrain::SetLearnPrameters |
( |
double const |
initConst, |
|
|
double const |
etZ, |
|
|
double const |
etF, |
|
|
unsigned int const |
Nswp |
|
) |
| |
|
inline |
Sets the learning parameters.
- Parameters
-
initConst | Initialization constant, used to initialize LVQ prototypes. |
etZ | EthaZero, start value for the learning rate. |
etF | Final value for Etha (learning rate) |
Nswp | Number of sweeps through the examples collection set. |
Definition at line 285 of file PndLVQTrain.h.
References m_ethaFinal, m_ethaZero, m_initConst, and m_NumSweep.
unsigned int m_NumSweep
Number of sweeps through example set.
void PndLVQTrain::SetLVQ2_1WindowSize |
( |
float const |
Wsize = 0.3 | ) |
|
|
inline |
Set the window size for LVQ2.1 alg. A value between 0.2 & 0.3 is recommended.
Definition at line 299 of file PndLVQTrain.h.
References m_WindowSize.
void PndLVQTrain::SetNumberOfProto |
( |
size_t const |
numProto | ) |
|
Set the number of protoTypes to be used for training. The same number of prototypes are initialized for all available labels(classes).
- Parameters
-
numProto | Number of prototypes. |
void PndLVQTrain::SetNumberOfProto |
( |
std::map< std::string, size_t > const & |
labelMap | ) |
|
Set the number of protoTypes to be used for training.
- Parameters
-
labelMap | Map containing number of prototypes for each class (label). |
void PndMvaTrainer::SetOutPutFile |
( |
std::string const & |
outFile | ) |
|
|
inlineinherited |
void PndLVQTrain::SetPerEpochEval |
( |
bool |
val | ) |
|
|
inline |
Select if we want to follow the training evaluation per epoch (sweeps) or per step. The number of steps = Sweeps * (#examples).
- Parameters
-
val | true = evaluate per epoch, false per step. Default is false. |
Definition at line 304 of file PndLVQTrain.h.
References m_PerEpoch, and val.
Double_t val[nBoxes][nFEBox]
bool m_PerEpoch
If evaluate per epoch.
Set CodeBook init type.
- Parameters
-
iniTypeVal | Initialization type. |
Definition at line 275 of file PndLVQTrain.h.
References m_proto_init.
ProtoInitType m_proto_init
Proto init type.
void PndMvaTrainer::SetRndSeed |
( |
size_t const |
sd | ) |
|
|
inlineinherited |
void PndMvaTrainer::SetTestSet |
( |
std::set< size_t > const & |
testSet | ) |
|
|
inherited |
Set the indices of events that are going to be used for testing.
- Parameters
-
testSet | Set containing the indices of the test events. |
void PndMvaTrainer::SetTestSetSize |
( |
size_t |
percent = 50 | ) |
|
|
inherited |
Creates test and train data sets.
- Parameters
-
percent | Percent of the data set to be used for testing. |
void PndMvaTrainer::splitTetsSet |
( |
| ) |
|
|
protectedinherited |
void PndLVQTrain::storeWeights |
( |
| ) |
|
|
virtual |
Store weights in the output File. If output file name is not specified, then write nothing.
Implements PndMvaTrainer.
void PndLVQTrain::Train |
( |
| ) |
|
|
virtual |
Train the classifier accourding to LVQ1 algorithm.
Implements PndMvaTrainer.
void PndLVQTrain::Train21 |
( |
| ) |
|
Train the classifier accourding to LVQ2.1 algorithm.
void PndLVQTrain::UpdateProto |
( |
std::vector< float > const & |
EvtData, |
|
|
std::vector< float > & |
proto, |
|
|
int const |
delta, |
|
|
double const |
ethaT |
|
) |
| |
|
private |
Updates the LVQ prototypes.
void PndLVQTrain::ValidateProtoUpdate |
( |
std::vector< float > & |
p | ) |
|
|
private |
Check if the current update creates an invalid codebook (If the vectore is placed outside the extrema). If after the update the codebook is out of boundary: reinitialize. Else: do nothing.
- Parameters
-
p | The to be validated prototype. |
void PndMvaTrainer::WriteErroVect |
( |
std::string const & |
FileName | ) |
const |
|
inherited |
Writes the train and test errors evaluations to a given file.
- Parameters
-
FileName | Output file name. |
void PndMvaTrainer::WriteToWeightFile |
( |
std::vector< std::pair< std::string, std::vector< float > * > > const & |
weights | ) |
const |
|
protectedinherited |
Write the training and normalization data to outFile.
unsigned int PndLVQTrain::m_ErrorStep |
|
private |
double PndLVQTrain::m_ethaFinal |
|
private |
double PndLVQTrain::m_ethaZero |
|
private |
double PndLVQTrain::m_initConst |
|
private |
std::string PndLVQTrain::m_initProtoFile |
|
private |
std::vector< std::pair<std::string, std::vector<float>*> > PndLVQTrain::m_LVQProtos |
|
private |
std::map< std::string, size_t> PndLVQTrain::m_numProtoPerClass |
|
private |
Map labels (classes) to number of prototypes.
Definition at line 267 of file PndLVQTrain.h.
unsigned int PndLVQTrain::m_NumSweep |
|
private |
std::string PndMvaTrainer::m_outFile |
|
protectedinherited |
bool PndLVQTrain::m_PerEpoch |
|
private |
unsigned int PndLVQTrain::m_ProgStep |
|
private |
size_t PndMvaTrainer::m_RND_seed |
|
protectedinherited |
std::vector<StepError> PndMvaTrainer::m_StepErro |
|
protectedinherited |
std::set<size_t> PndMvaTrainer::m_testSet_indices |
|
protectedinherited |
float PndLVQTrain::m_WindowSize |
|
private |
The documentation for this class was generated from the following file: