Doxygen
TrainExamples Class Reference

#include <TrainExamples.h>

Public Member Functions

 TrainExamples (const char *positivePaths, long double positiveWeight, const char *negativePaths, const char *negativeImages, int numberNegatives, vector< stumpRule > *cascade, VectorXf &tweaks, int layerCount, VectorXi *blackList, const char *toFile, bool trainMode, bool allInMemory)
 constructor to use if you have enough memory More...
 
 ~TrainExamples ()
 
VectorXi * calcEmpiricalError (vector< stumpRule > const *cascade, VectorXf &tweaks, int layerCount, float &falsePositive, float &detectionRate, bool hasReturn)
 evaluate how the committee fares on a dataset More...
 
void adaboost ()
 perform one round of adaboost More...
 

Public Attributes

int nPositives
 what's inside More...
 
int nNegatives
 
int sampleCount
 
bool inTrain
 
long double initialPositiveWeight
 
long double exponentialRisk
 
long double positiveTotalWeight
 
long double negativeTotalWeight
 
long double minWeight
 
long double maxWeight
 
VectorXld weights
 
VectorXi labels
 
vector< pair< float, int > > * ascendingFeatures
 
int featureCount
 
vector< stumpRulecommittee
 
const char * negativeImagePaths
 
MatrixXf * validationExamples
 

Private Member Functions

MatrixXf ** sampleNegatives (int patchSize, vector< stumpRule > *cascade, VectorXf &tweaks, int layerCount, const char *negativeExamples, VectorXi *blackList)
 get some extra negatives if necessary More...
 
bool myStumpOrder (const stumpRule &one, const stumpRule &other)
 what makes one stump better than the other More...
 
int getExampleIndex (int featureIndex, int iterator)
 return for an element pointed by iterator and featureIndex its exampleIndex More...
 
float getExampleFeature (int featureIndex, int iterator)
 return for an element pointed by iterator and featureIndex its example value More...
 
void decisionStump (int featureIndex, stumpRule &best)
 best stump given a feature More...
 
stumpRule bestStump ()
 best stump among all features More...
 
void predictLabel (float thresholdTweak, RowVectorXi &prediction, bool onlyMostRecent)
 given a tweak and a committe, what prediction do you make as to the examples More...
 

Detailed Description

Definition at line 54 of file TrainExamples.h.

Constructor & Destructor Documentation

TrainExamples::TrainExamples ( const char *  positivePaths,
long double  positiveWeight,
const char *  negativePaths,
const char *  negativeImages,
int  numberNegatives,
vector< stumpRule > *  cascade,
VectorXf &  tweaks,
int  layerCount,
VectorXi *  blackList,
const char *  toFile,
bool  trainMode,
bool  allInMemory 
)

constructor to use if you have enough memory

Parameters
positivePathspaths leading to positive examples
negativePathspaths leading to negative examples
toFileall the relevant information for building the detector
blackListwhat are the examples to eliminate before starting training
positiveWeighthow much weight to give to positive examples at the beginning
trainModetraining or validation set
allInMemorydo everything in memory or on disk

Definition at line 42 of file TrainExamples.cpp.

TrainExamples::~TrainExamples ( )

Definition at line 162 of file TrainExamples.cpp.

Member Function Documentation

void TrainExamples::adaboost ( )

perform one round of adaboost

Definition at line 457 of file TrainExamples.cpp.

stumpRule TrainExamples::bestStump ( )
private

best stump among all features

Definition at line 432 of file TrainExamples.cpp.

VectorXi * TrainExamples::calcEmpiricalError ( vector< stumpRule > const *  cascade,
VectorXf &  tweaks,
int  layerCount,
float &  falsePositive,
float &  detectionRate,
bool  hasReturn 
)

evaluate how the committee fares on a dataset

Parameters
cascadea given cascade of committees
tweaksused for fulfill each layer's training target
layerCounthow many layers are there in the cascade
Returns
falsePositive
detectionRate
Parameters
hasReturnwhether to return a blackList pointing to false negative and true negatives

Definition at line 524 of file TrainExamples.cpp.

void TrainExamples::decisionStump ( int  featureIndex,
stumpRule best 
)
private

best stump given a feature

Definition at line 318 of file TrainExamples.cpp.

float TrainExamples::getExampleFeature ( int  featureIndex,
int  iterator 
)
inlineprivate

return for an element pointed by iterator and featureIndex its example value

Definition at line 177 of file TrainExamples.h.

int TrainExamples::getExampleIndex ( int  featureIndex,
int  iterator 
)
inlineprivate

return for an element pointed by iterator and featureIndex its exampleIndex

Definition at line 167 of file TrainExamples.h.

bool TrainExamples::myStumpOrder ( const stumpRule one,
const stumpRule other 
)
private

what makes one stump better than the other

Definition at line 304 of file TrainExamples.cpp.

void TrainExamples::predictLabel ( float  thresholdTweak,
RowVectorXi &  prediction,
bool  onlyMostRecent 
)
private

given a tweak and a committe, what prediction do you make as to the examples

Parameters
thresholdTweaktweak
Returns
prediction
Parameters
onlyMostRecentuse all the committee or its most recent member (a weak learner)

Definition at line 265 of file TrainExamples.cpp.

MatrixXf ** TrainExamples::sampleNegatives ( int  patchSize,
vector< stumpRule > *  cascade,
VectorXf &  tweaks,
int  layerCount,
const char *  negativeExamples,
VectorXi *  blackList 
)
private

get some extra negatives if necessary

Definition at line 171 of file TrainExamples.cpp.

Member Data Documentation

vector< pair<float, int> >* TrainExamples::ascendingFeatures

Definition at line 87 of file TrainExamples.h.

vector<stumpRule> TrainExamples::committee

Definition at line 89 of file TrainExamples.h.

long double TrainExamples::exponentialRisk

Definition at line 80 of file TrainExamples.h.

int TrainExamples::featureCount

Definition at line 88 of file TrainExamples.h.

long double TrainExamples::initialPositiveWeight

Definition at line 79 of file TrainExamples.h.

bool TrainExamples::inTrain

Definition at line 78 of file TrainExamples.h.

VectorXi TrainExamples::labels

Definition at line 86 of file TrainExamples.h.

long double TrainExamples::maxWeight

Definition at line 84 of file TrainExamples.h.

long double TrainExamples::minWeight

Definition at line 83 of file TrainExamples.h.

const char* TrainExamples::negativeImagePaths

Definition at line 90 of file TrainExamples.h.

long double TrainExamples::negativeTotalWeight

Definition at line 82 of file TrainExamples.h.

int TrainExamples::nNegatives

Definition at line 76 of file TrainExamples.h.

int TrainExamples::nPositives

what's inside

Parameters
nPositivesnumber of positive examples
nNegativesnumber of negative examples
sampleCountnPositives + nNegatives
inTrainis this a training set or a validation set
initialPositiveWeighthow much weight we give to positives at the outset
exponentialRiskexponential risk for training set
positiveTotalWeighttotal weight received by positive examples currently
negativeTotalWeighttotal weight received by negative examples currently
minWeightminimum weight among all weights currently
maxWeightmaximum weight among all weights currently
weightsweight vector for all examples involved
labelsare they positive or negative examples
ascendingFeaturesfor each feature, we have (float feature value, int exampleIndex)
featureCounthow many features are there
committeewhat's the learned committee

Definition at line 75 of file TrainExamples.h.

long double TrainExamples::positiveTotalWeight

Definition at line 81 of file TrainExamples.h.

int TrainExamples::sampleCount

Definition at line 77 of file TrainExamples.h.

MatrixXf* TrainExamples::validationExamples

Definition at line 91 of file TrainExamples.h.

VectorXld TrainExamples::weights

Definition at line 85 of file TrainExamples.h.


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