![]() |
KSquare Utilities
|
#include <Classifier2.h>
Public Types | |
| typedef Classifier2 * | Classifier2Ptr |
Public Member Functions | |
| Classifier2 (TrainingProcess2Ptr _trainer, RunLog &_log) | |
| virtual | ~Classifier2 () |
| bool | Abort () const |
| MLClassPtr | ClassifyAExample (FeatureVector &example) |
| void | ClassifyAExample (FeatureVector &example, MLClassPtr &predClass1, MLClassPtr &predClass2, kkint32 &predClass1Votes, kkint32 &predClass2Votes, double &knownClassProb, double &predClass1Prob, double &predClass2Prob, kkint32 &numOfWinners, double &breakTie) |
| MLClassPtr | ClassifyAExample (FeatureVector &example, kkint32 &numOfWinners, bool &knownClassOneOfTheWinners) |
| MLClassPtr | ClassifyAExample (FeatureVector &example, double &probability, kkint32 &numOfWinners, bool &knownClassOneOfTheWinners, double &breakTie) |
| const KKStr & | ConfigRootName () const |
| std::vector< ProbNamePair > | FindWorstSupportVectors (FeatureVectorPtr example, kkint32 numToFind, MLClassPtr c1, MLClassPtr c2) |
| For a given two class pair return the names of the 'numToFind' worst S/V's. More... | |
| std::vector< ProbNamePair > | FindWorstSupportVectors2 (FeatureVectorPtr example, kkint32 numToFind, MLClassPtr c1, MLClassPtr c2) |
| For a given two class pair return the names of the 'numToFind' worst S/V's. More... | |
| virtual kkint32 | MemoryConsumedEstimated () const |
| void | PredictRaw (FeatureVectorPtr example, MLClassPtr &predClass, double &dist) |
| ClassProbList const * | PriorProbability () const |
| Returns the distribution of the training data used to build the classifier. More... | |
| void | ProbabilitiesByClass (const MLClassList &classes, FeatureVectorPtr example, kkint32 *votes, double *probabilities) |
| For a given feature vector return back the probabilities and votes for each class. More... | |
| ClassProbListPtr | ProbabilitiesByClass (FeatureVectorPtr example) |
| void | ProbabilitiesByClassDual (FeatureVectorPtr example, KKStr &classifier1Desc, KKStr &classifier2Desc, ClassProbListPtr &classifier1Results, ClassProbListPtr &classifier2Results) |
| void | RetrieveCrossProbTable (MLClassList &classes, double **crossProbTable) |
| SVM_SelectionMethod | SelectionMethod () const |
| std::vector< KKStr > | SupportVectorNames (MLClassPtr c1, MLClassPtr c2) |
Definition at line 75 of file Classifier2.h.
Definition at line 78 of file Classifier2.h.
| Classifier2::Classifier2 | ( | TrainingProcess2Ptr | _trainer, |
| RunLog & | _log | ||
| ) |
Definition at line 42 of file Classifier2.cpp.
References KKMLL::TrainingProcess2::Abort(), KKB::KKStr::Concat(), KKMLL::TrainingProcess2::Config(), KKMLL::TrainingConfiguration2::ConfigRootName(), KKMLL::TrainingProcess2::FeaturesAlreadyNormalized(), KKMLL::MLClassList::GetNoiseClass(), KKMLL::MLClassList::GetUnKnownClass(), KKB::KKException::KKException(), KKB::KKStr::KKStr(), KKMLL::TrainingProcess2::MLClasses(), KKMLL::MLClassList::MLClassList(), KKMLL::Model::ModelType(), KKMLL::Model::OldSVM, KKB::KKStr::operator=(), KKMLL::ModelOldSVM::SvmModel(), KKMLL::TrainingProcess2::TrainedModel(), and KKMLL::Model::ValidModel().
Referenced by KKMLL::ModelDual::ReadXML(), and KKMLL::ModelDual::TrainModel().
|
virtual |
Definition at line 113 of file Classifier2.cpp.
|
inline |
Definition at line 86 of file Classifier2.h.
| MLClassPtr Classifier2::ClassifyAExample | ( | FeatureVector & | example | ) |
Definition at line 413 of file Classifier2.cpp.
References ClassifyAExample().
Referenced by KKMLL::ModelDual::Predict().
| void Classifier2::ClassifyAExample | ( | FeatureVector & | example, |
| MLClassPtr & | predClass1, | ||
| MLClassPtr & | predClass2, | ||
| kkint32 & | predClass1Votes, | ||
| kkint32 & | predClass2Votes, | ||
| double & | knownClassProb, | ||
| double & | predClass1Prob, | ||
| double & | predClass2Prob, | ||
| kkint32 & | numOfWinners, | ||
| double & | breakTie | ||
| ) |
Definition at line 270 of file Classifier2.cpp.
References ClassifyAExample(), KKMLL::FeatureVector::MLClass(), and KKMLL::Model::Predict().
Referenced by ClassifyAExample(), and KKMLL::ModelDual::Predict().
| MLClassPtr Classifier2::ClassifyAExample | ( | FeatureVector & | example, |
| kkint32 & | numOfWinners, | ||
| bool & | knownClassOneOfTheWinners | ||
| ) |
| MLClassPtr Classifier2::ClassifyAExample | ( | FeatureVector & | example, |
| double & | probability, | ||
| kkint32 & | numOfWinners, | ||
| bool & | knownClassOneOfTheWinners, | ||
| double & | breakTie | ||
| ) |
Definition at line 373 of file Classifier2.cpp.
|
inline |
Definition at line 87 of file Classifier2.h.
Referenced by KKMLL::Classifier2List::LookUpByName().
| vector< ProbNamePair > Classifier2::FindWorstSupportVectors | ( | FeatureVectorPtr | example, |
| kkint32 | numToFind, | ||
| MLClassPtr | c1, | ||
| MLClassPtr | c2 | ||
| ) |
For a given two class pair return the names of the 'numToFind' worst S/V's.
This method will iterate through all the S/V's removing them one at a time and re-compute the decision boundary and probability. It will then return the S/V's that when removed improve the probability in 'c1's the most.
| [in] | example | The example that was classified incorrectly. |
| [in] | numToFind | The number of the worst examples you are looking for. |
| [in] | c1 | Class that the 'example; parameter should have been classed as. |
| [in] | c2 | Class that it was classified as. |
Definition at line 442 of file Classifier2.cpp.
| vector< ProbNamePair > Classifier2::FindWorstSupportVectors2 | ( | FeatureVectorPtr | example, |
| kkint32 | numToFind, | ||
| MLClassPtr | c1, | ||
| MLClassPtr | c2 | ||
| ) |
For a given two class pair return the names of the 'numToFind' worst S/V's.
This method will iterate through all the S/V's removing them one at a time and rebuild a new SVM then submit example for testing.
| [in] | example | The example that was classified incorrectly. |
| [in] | numToFind | The number of the worst examples you are looking for. |
| [in] | c1 | Class that the 'example; parameter should have been classed as. |
| [in] | c2 | Class that it was classified as. |
Definition at line 460 of file Classifier2.cpp.
|
virtual |
Definition at line 120 of file Classifier2.cpp.
References KKMLL::MLClassList::MemoryConsumedEstimated().
Referenced by KKMLL::ModelDual::MemoryConsumedEstimated().
| void Classifier2::PredictRaw | ( | FeatureVectorPtr | example, |
| MLClassPtr & | predClass, | ||
| double & | dist | ||
| ) |
Definition at line 478 of file Classifier2.cpp.
References PredictRaw(), and KKMLL::Model::PredictRaw().
Referenced by PredictRaw().
| ClassProbList const * Classifier2::PriorProbability | ( | ) | const |
Returns the distribution of the training data used to build the classifier.
The caller will NOT own this list. Ownership will remain with 'trainingProcess' member of this class.
Definition at line 139 of file Classifier2.cpp.
References KKMLL::TrainingProcess2::PriorProbability().
| void Classifier2::ProbabilitiesByClass | ( | const MLClassList & | classes, |
| FeatureVectorPtr | example, | ||
| kkint32 * | votes, | ||
| double * | probabilities | ||
| ) |
For a given feature vector return back the probabilities and votes for each class.
| classes | [in] List of classes that we can be predicted for The ordering of 'votes' and 'probabilities' will be dictated by this list. |
| example | [in] Feature Vector to make prediction on. |
| votes | [out] Pointer to list of int's, must be as large as 'classes' The number of votes for each corresponding class will be stored hear. |
| probabilities | [out] Pointer to list of double's, must be as large as 'classes' The probability for each corresponding class will be stored hear. |
Definition at line 495 of file Classifier2.cpp.
References KKMLL::ClassProbList::LookUp(), ProbabilitiesByClass(), KKMLL::ClassProb::probability, and KKMLL::ClassProb::votes.
| ClassProbListPtr Classifier2::ProbabilitiesByClass | ( | FeatureVectorPtr | example | ) |
Definition at line 671 of file Classifier2.cpp.
References KKMLL::Model::ProbabilitiesByClass().
Referenced by KKMLL::ModelDual::ProbabilitiesByClass(), ProbabilitiesByClass(), KKMLL::ModelDual::ProbabilitiesByClassDual(), and KKMLL::ModelDual::ReconcileProbAndVotes().
| void Classifier2::ProbabilitiesByClassDual | ( | FeatureVectorPtr | example, |
| KKStr & | classifier1Desc, | ||
| KKStr & | classifier2Desc, | ||
| ClassProbListPtr & | classifier1Results, | ||
| ClassProbListPtr & | classifier2Results | ||
| ) |
Definition at line 704 of file Classifier2.cpp.
References KKMLL::Model::ProbabilitiesByClassDual().
| void Classifier2::RetrieveCrossProbTable | ( | MLClassList & | classes, |
| double ** | crossProbTable | ||
| ) |
Definition at line 692 of file Classifier2.cpp.
References KKMLL::Model::RetrieveCrossProbTable().
Referenced by KKMLL::ModelDual::RetrieveCrossProbTable().
| SVM_SelectionMethod Classifier2::SelectionMethod | ( | ) | const |
Definition at line 129 of file Classifier2.cpp.
References KKMLL::Null, and KKMLL::ModelOldSVM::SelectionMethod().
| vector< KKStr > Classifier2::SupportVectorNames | ( | MLClassPtr | c1, |
| MLClassPtr | c2 | ||
| ) |
Definition at line 423 of file Classifier2.cpp.