![]() |
KSquare Utilities
|
Represents a Feature Vector of a single example, labeled or unlabeled. More...
#include <FeatureVector.h>
Inheritance diagram for KKMLL::FeatureVector:Public Types | |
| typedef FeatureVector * | FeatureVectorPtr |
| typedef float | FVFloat |
Public Member Functions | |
| FeatureVector (kkint32 _numOfFeatures) | |
| FeatureVector (const FeatureVector &_example) | |
| virtual | ~FeatureVector () |
| void | AddFeatureData (kkint32 _featureNum, float _featureData) |
| void | BreakTie (float _breakTie) |
| Update the BreakTie value. More... | |
| float | BreakTie () const |
| The difference in probability between the two most likely classes. More... | |
| const KKStr & | ClassName () const |
| Name of class that this example is assigned to. More... | |
| virtual FeatureVectorPtr | Duplicate () const |
| void | ExampleFileName (const KKStr &_exampleFileName) |
| Name of source of feature vector, ex: file name of image that the feature vector was computed from. More... | |
| const KKStr & | ExampleFileName () const |
| Name of file that this FeatureVector was computed from. More... | |
| void | FeatureData (kkint32 _featureNum, float _featureValue) |
| Assign a value to a specific feature number for the feature vector. More... | |
| float | FeatureData (kkint32 featureNum) const |
| const float * | FeatureData () const |
| Returns as a pointer to the feature data itself. More... | |
| float * | FeatureDataAlter () |
| Same as 'FeatureData() except you can modify the data. More... | |
| const float * | FeatureDataConst () const |
| bool | FeatureDataValid () |
| virtual kkint32 | MemoryConsumedEstimated () const |
| void | MissingData (bool _missingData) |
| True indicates that not all the feature data was present when this example was loaded from a data file. More... | |
| bool | MissingData () const |
| True indicates that one or more features were missing. More... | |
| void | MLClass (MLClassPtr _mlClass) |
| Assign a class to this example. More... | |
| MLClassPtr | MLClass () const |
| Class that is example is assigned to. More... | |
| const KKStr & | MLClassName () const |
| Name of class that this example is assigned to. More... | |
| kkint32 | NumOfFeatures () const |
| Number of features in this FeatureVector. More... | |
| bool | operator== (FeatureVector &other_example) const |
| void | OrigSize (float _origSize) |
| The value of Feature[0] before normalization. More... | |
| float | OrigSize () const |
| The value of Feature[0] before normalization. More... | |
| void | PredictedClass (MLClassPtr _predictedClass) |
| MLClassPtr | PredictedClass () const |
| const KKStr & | PredictedClassName () const |
| void | Probability (float _probability) |
| Assign a prediction probability to this example. More... | |
| float | Probability () const |
| The probability assigned by classifier to the predicted class. More... | |
| void | ResetNumOfFeatures (kkint32 newNumOfFeatures) |
| float | TotalOfFeatureData () const |
| Returns the total of all Feature Attributes for this feature vector. More... | |
| void | TrainWeight (float _trainWeight) |
| Assign a specific example a higher weight for training purposes. More... | |
| float | TrainWeight () const |
| void | Validated (bool _validated) |
| Indicated whether an expert has validated the class assignment. More... | |
| bool | Validated () const |
| void | Version (kkint16 _version) |
| kkint16 | Version () const |
Protected Member Functions | |
| void | AllocateFeatureDataArray () |
| Used by container classes such as 'FeatureVectorList'. This way they can determine real underlying class. More... | |
Protected Attributes | |
| float * | featureData |
| kkint32 | numOfFeatures |
Represents a Feature Vector of a single example, labeled or unlabeled.
Used for the representation of a Single example. You create an instance of this object for each single feature vector. You can subclass from this Class to make a specialized FeatureVector as in the PostLarvaeFV class. Besides keeping track of feature data this class will also track other fields such as ExampleFileName which should indicate where the FeatureVector was derived from, probability, breakTie, and others.
Used for the representation of a Single example. You create an instance of this object for each single feature vector. You can subclass from this Class to make a specialized FeatureVector as in the PostLarvaeFV class. Besides keeping track of feature data this class will also track other fields such as ExampleFileName which should indicate where the FeatureVector was derived from, probability, breakTie, and others.
Definition at line 59 of file FeatureVector.h.
Definition at line 63 of file FeatureVector.h.
| typedef float KKMLL::FeatureVector::FVFloat |
Definition at line 62 of file FeatureVector.h.
| FeatureVector::FeatureVector | ( | kkint32 | _numOfFeatures | ) |
Definition at line 30 of file FeatureVector.cpp.
References AllocateFeatureDataArray(), featureData, KKB::KKStr::KKStr(), and numOfFeatures.
Referenced by KKMLL::GrayScaleImagesFVProducer::ComputeFeatureVector(), KKMLL::FeatureEncoder::CreateEncodedFeatureVector(), KKMLL::FeatureEncoder2::EncodeAExample(), KKMLL::FeatureEncoder::EncodeAExample(), KKMLL::GrayScaleImagesFV::GrayScaleImagesFV(), KKMLL::FeatureFileIODstWeb::LoadFile(), KKMLL::FeatureFileIOColumn::LoadFile(), KKMLL::FeatureFileIOUCI::LoadFile(), KKMLL::FeatureFileIOC45::LoadFile(), and KKMLL::FactoryFVProducer::ManufacturFeatureVector().
| FeatureVector::FeatureVector | ( | const FeatureVector & | _example | ) |
Definition at line 50 of file FeatureVector.cpp.
References AllocateFeatureDataArray(), featureData, KKB::KKStr::KKStr(), and numOfFeatures.
Referenced by Duplicate(), KKMLL::FeatureVectorList::DuplicateListAndContents(), KKMLL::FeatureVectorList::ExtractExamplesForHierarchyLevel(), KKMLL::GrayScaleImagesFV::GrayScaleImagesFV(), and KKMLL::NormalizationParms::ToNormalized().
|
virtual |
| void FeatureVector::AddFeatureData | ( | kkint32 | _featureNum, |
| float | _featureData | ||
| ) |
| _featureNum | Indicates which feature number to update. |
| _featureData | New value to assign to '_featureNum'. |
Definition at line 216 of file FeatureVector.cpp.
References KKB::KKStr::Concat(), featureData, KKB::KKException::KKException(), KKB::KKStr::KKStr(), and numOfFeatures.
Referenced by KKMLL::FeatureEncoder::CreateEncodedFeatureVector(), KKMLL::FeatureEncoder2::EncodeAExample(), KKMLL::FeatureEncoder::EncodeAExample(), KKMLL::FeatureFileIODstWeb::LoadFile(), KKMLL::FeatureFileIOC45::LoadFile(), and KKMLL::FeatureVectorList::ReSyncSymbolicData().
|
protected |
Used by container classes such as 'FeatureVectorList'. This way they can determine real underlying class.
Definition at line 129 of file FeatureVector.cpp.
References featureData, and numOfFeatures.
Referenced by FeatureVector().
|
inline |
Update the BreakTie value.
Definition at line 73 of file FeatureVector.h.
|
inline |
The difference in probability between the two most likely classes.
Definition at line 112 of file FeatureVector.h.
Referenced by KKMLL::FeatureVectorList::BreakTieComparison::operator()(), and KKMLL::FeatureVectorList::BreakTieComparisonReversed::operator()().
| const KKStr & FeatureVector::ClassName | ( | ) | const |
Name of class that this example is assigned to.
Definition at line 192 of file FeatureVector.cpp.
References KKB::KKStr::Concat(), and KKMLL::MLClass::Name().
Referenced by KKMLL::FeatureFileIORoberts::SaveFile(), KKMLL::FeatureFileIOUCI::SaveFile(), KKMLL::FeatureFileIOC45::SaveFile(), and KKMLL::FeatureFileIOSparse::SaveFile().
|
virtual |
Reimplemented in KKMLL::GrayScaleImagesFV.
Definition at line 94 of file FeatureVector.cpp.
References FeatureVector().
|
inline |
Name of source of feature vector, ex: file name of image that the feature vector was computed from.
Definition at line 75 of file FeatureVector.h.
References KKB::KKStr::operator=().
Referenced by KKMLL::FeatureFileIO::FeatureDataReSink(), KKMLL::FeatureFileIODstWeb::LoadFile(), KKMLL::FeatureFileIOColumn::LoadFile(), KKMLL::FeatureFileIOUCI::LoadFile(), KKMLL::FeatureFileIOC45::LoadFile(), and KKMLL::FeatureFileIO::LoadInSubDirectoryTree().
|
inline |
Name of file that this FeatureVector was computed from.
Definition at line 116 of file FeatureVector.h.
Referenced by KKMLL::DuplicateImages::AddSingleExample(), KKMLL::FeatureVectorList::BinarySearchByName(), KKMLL::DuplicateImage::ExampleWithSmallestScanLine(), KKMLL::FeatureVectorList::ExtractDuplicatesByRootImageFileName(), KKMLL::ExtractExampleFileName::ExtractKey(), KKMLL::FeatureFileIO::LoadInSubDirectoryTree(), KKMLL::FeatureVectorList::LookUpByRootName(), KKMLL::FeatureVectorList::ImageFileNameComparison::operator()(), KKMLL::FeatureVectorList::ImageFileNameComparisonReversed::operator()(), KKMLL::FeatureVectorList::RootNameComparrison::operator()(), KKMLL::FeatureVectorList::RootNameComparrisonReversed::operator()(), KKMLL::FeatureVectorList::ClassNameComparrison::operator()(), KKMLL::FeatureVectorList::ClassNameComparrisonReversed::operator()(), KKMLL::GrayScaleImagesFVList::RecalcFeatureValuesFromImagesInDirTree(), SVM289_BFS::svm_model::Write(), and SVM289_MFS::Svm_Model::WriteXML().
| void FeatureVector::FeatureData | ( | kkint32 | _featureNum, |
| float | _featureValue | ||
| ) |
Assign a value to a specific feature number for the feature vector.
This method will validate that '_featureNum' is not out of range (0 - 'numOfFeatures'). This will prevent the caller from corrupting memory.
| [in] | _featureNum | Feature Number to assign '_featureValue' to. |
| [in] | _featureValue | Value to assign to feature '_featureNum'. |
Definition at line 161 of file FeatureVector.cpp.
References featureData, and NumOfFeatures().
Referenced by KKMLL::GrayScaleImagesFVList::RecalcFeatureValuesFromImagesInDirTree().
| float FeatureVector::FeatureData | ( | kkint32 | featureNum | ) | const |
Definition at line 145 of file FeatureVector.cpp.
References featureData, and NumOfFeatures().
Referenced by KKMLL::FeatureVectorList::CalcStatsForFeatureNum(), KKMLL::GrayScaleImagesFVList::RecalcFeatureValuesFromImagesInDirTree(), KKMLL::FeatureVectorList::ReSyncSymbolicData(), KKMLL::FeatureFileIORoberts::SaveFile(), KKMLL::FeatureFileIOC45::SaveFile(), KKMLL::FeatureFileIOSparse::SaveFile(), and SVM289_MFS::Svm_Model::WriteXML().
|
inline |
Returns as a pointer to the feature data itself.
Definition at line 128 of file FeatureVector.h.
References featureData.
Referenced by SVM289_MFS::Kernel::DotStatic(), SVM289_BFS::Kernel::DotStatic(), KKMLL::FeatureEncoder2::EncodeAExample(), KKMLL::FeatureEncoder::EncodeAExample(), SVM289_MFS::Kernel::k_function(), and SVM289_BFS::Kernel::k_function().
|
inline |
Same as 'FeatureData() except you can modify the data.
Definition at line 129 of file FeatureVector.h.
References featureData.
Referenced by KKMLL::GrayScaleImagesFVProducer::ComputeFeatureVector(), KKMLL::NormalizationParms::NormalizeAExample(), and KKMLL::NormalizationParms::ToNormalized().
|
inline |
Definition at line 131 of file FeatureVector.h.
References featureData.
Referenced by KKMLL::ImageFeaturesNodeKey::CompareTwoExamples(), and KKMLL::FeatureVectorList::ExtractMeanFeatureValues().
| bool FeatureVector::FeatureDataValid | ( | ) |
Definition at line 234 of file FeatureVector.cpp.
References featureData, KKB::FloatMax, KKB::FloatMin, and numOfFeatures.
|
virtual |
Definition at line 81 of file FeatureVector.cpp.
References featureData, KKB::KKStr::MemoryConsumedEstimated(), and numOfFeatures.
Referenced by KKMLL::FeatureVectorList::MemoryConsumedEstimated().
|
inline |
True indicates that not all the feature data was present when this example was loaded from a data file.
Definition at line 76 of file FeatureVector.h.
Referenced by KKMLL::FeatureFileIOC45::LoadFile().
|
inline |
True indicates that one or more features were missing.
Definition at line 117 of file FeatureVector.h.
Referenced by KKMLL::FeatureVectorList::MissingData().
|
inline |
Assign a class to this example.
Definition at line 74 of file FeatureVector.h.
Referenced by KKMLL::Classifier2::ClassifyAExample(), KKMLL::GrayScaleImagesFVProducer::ComputeFeatureVector(), KKMLL::FeatureEncoder::CreateEncodedFeatureVector(), KKMLL::FeatureEncoder2::EncodeAExample(), KKMLL::FeatureEncoder::EncodeAExample(), KKMLL::FeatureEncoder2::EncodedFeatureVectorList(), KKMLL::FeatureVectorList::ExtractExamplesForHierarchyLevel(), KKMLL::FeatureFileIO::FeatureDataReSink(), KKMLL::FeatureFileIODstWeb::LoadFile(), KKMLL::FeatureFileIOColumn::LoadFile(), KKMLL::FeatureFileIOUCI::LoadFile(), and KKMLL::FeatureFileIOC45::LoadFile().
|
inline |
Class that is example is assigned to.
Definition at line 114 of file FeatureVector.h.
Referenced by KKMLL::Classifier2::ClassifyAExample(), KKMLL::FeatureEncoder::CreateEncodedFeatureVector(), KKMLL::FeatureEncoder2::EncodeAExample(), KKMLL::FeatureEncoder::EncodeAExample(), KKMLL::FeatureEncoder2::EncodedFeatureVectorList(), KKMLL::FeatureEncoder::EncodeIntoSparseMatrix(), KKMLL::FeatureVectorList::ExtractExamplesForAGivenClass(), KKMLL::FeatureVectorList::ExtractExamplesForHierarchyLevel(), KKMLL::FeatureVectorList::ExtractListOfClasses(), KKMLL::FeatureFileIO::FeatureDataReSink(), KKMLL::FeatureVectorList::GetClassStatistics(), KKMLL::FeatureVectorList::ClassNameComparrison::operator()(), KKMLL::FeatureVectorList::ClassNameComparrisonReversed::operator()(), and KKMLL::GrayScaleImagesFVList::RecalcFeatureValuesFromImagesInDirTree().
| const KKStr & FeatureVector::MLClassName | ( | ) | const |
Name of class that this example is assigned to.
Definition at line 262 of file FeatureVector.cpp.
References KKB::KKStr::Concat(), KKB::KKStr::EmptyStr(), and KKMLL::MLClass::Name().
|
inline |
Number of features in this FeatureVector.
Definition at line 118 of file FeatureVector.h.
References numOfFeatures.
Referenced by KKMLL::ImageFeaturesNodeKey::CompareTwoExamples(), FeatureData(), KKMLL::FeatureVectorList::PushOnBack(), KKMLL::FeatureVectorList::PushOnFront(), TotalOfFeatureData(), and SVM289_MFS::Svm_Model::WriteXML().
| bool FeatureVector::operator== | ( | FeatureVector & | other_example | ) | const |
|
inline |
The value of Feature[0] before normalization.
Definition at line 77 of file FeatureVector.h.
Referenced by KKMLL::GrayScaleImagesFVProducer::ComputeFeatureVector(), and KKMLL::GrayScaleImagesFVList::RecalcFeatureValuesFromImagesInDirTree().
|
inline |
The value of Feature[0] before normalization.
Definition at line 119 of file FeatureVector.h.
Referenced by KKMLL::FeatureVectorList::ExtractExamplesForAGivenClass(), and KKMLL::GrayScaleImagesFVList::RecalcFeatureValuesFromImagesInDirTree().
|
inline |
Definition at line 78 of file FeatureVector.h.
Referenced by KKMLL::FeatureEncoder2::EncodeAExample(), and KKMLL::FeatureEncoder::EncodeAExample().
|
inline |
Definition at line 120 of file FeatureVector.h.
Referenced by KKMLL::FeatureEncoder2::EncodeAExample(), and KKMLL::FeatureEncoder::EncodeAExample().
| const KKStr & FeatureVector::PredictedClassName | ( | ) | const |
Definition at line 251 of file FeatureVector.cpp.
References KKB::KKStr::Concat(), KKB::KKStr::EmptyStr(), and KKMLL::MLClass::Name().
|
inline |
Assign a prediction probability to this example.
Definition at line 79 of file FeatureVector.h.
|
inline |
The probability assigned by classifier to the predicted class.
Definition at line 122 of file FeatureVector.h.
Referenced by KKMLL::FeatureVectorList::ProbabilityComparison::operator()(), and KKMLL::FeatureVectorList::ProbabilityComparisonReversed::operator()().
| void FeatureVector::ResetNumOfFeatures | ( | kkint32 | newNumOfFeatures | ) |
Used to reallocate memory for feature data.
Definition at line 102 of file FeatureVector.cpp.
References KKB::KKStr::Concat(), featureData, KKB::KKException::KKException(), KKB::KKStr::KKStr(), and numOfFeatures.
Referenced by KKMLL::FeatureVectorList::ResetFileDesc(), and KKMLL::FeatureVectorList::ResetNumOfFeaturs().
| float FeatureVector::TotalOfFeatureData | ( | ) | const |
Returns the total of all Feature Attributes for this feature vector.
Definition at line 180 of file FeatureVector.cpp.
References featureData, and NumOfFeatures().
|
inline |
Assign a specific example a higher weight for training purposes.
The SVM will multiply the cost parameter by this amount when training the classifier for this specific example.
Definition at line 105 of file FeatureVector.h.
Referenced by KKMLL::FeatureEncoder2::EncodeAExample(), and KKMLL::FeatureEncoder::EncodeAExample().
|
inline |
Definition at line 123 of file FeatureVector.h.
Referenced by KKMLL::FeatureEncoder2::EncodeAExample(), KKMLL::FeatureEncoder::EncodeAExample(), and KKMLL::FeatureEncoder::EncodeIntoSparseMatrix().
|
inline |
Indicated whether an expert has validated the class assignment.
Definition at line 109 of file FeatureVector.h.
|
inline |
Definition at line 124 of file FeatureVector.h.
|
inline |
Definition at line 80 of file FeatureVector.h.
Referenced by KKMLL::GrayScaleImagesFVProducer::ComputeFeatureVector(), and KKMLL::GrayScaleImagesFVList::RecalcFeatureValuesFromImagesInDirTree().
|
inline |
Definition at line 125 of file FeatureVector.h.
Referenced by KKMLL::GrayScaleImagesFVList::RecalcFeatureValuesFromImagesInDirTree().
|
protected |
Definition at line 150 of file FeatureVector.h.
Referenced by AddFeatureData(), AllocateFeatureDataArray(), FeatureData(), FeatureDataAlter(), FeatureDataConst(), FeatureDataValid(), FeatureVector(), MemoryConsumedEstimated(), operator==(), ResetNumOfFeatures(), TotalOfFeatureData(), and ~FeatureVector().
|
protected |
Definition at line 151 of file FeatureVector.h.
Referenced by AddFeatureData(), AllocateFeatureDataArray(), FeatureDataValid(), FeatureVector(), MemoryConsumedEstimated(), NumOfFeatures(), operator==(), and ResetNumOfFeatures().