![]() |
KSquare Utilities
|
Binds MLClass objects to the appropriate number that the Learning Algorithm expects. More...
#include <ClassAssignments.h>
Inheritance diagram for KKMLL::ClassAssignments:Public Member Functions | |
| ClassAssignments () | |
| ClassAssignments (const MLClassList &classes) | |
| Creates assignment for all classes in 'classes. More... | |
| void | AddMLClass (MLClassPtr mlClass, kkint16 num, RunLog &log) |
| MLClassPtr | GetMLClass (kkint16 num) const |
| MLClassPtr | GetMLClassByIndex (size_t idx) |
| MLClassList | GetMLClasses (kkint16 num) const |
| kkint16 | GetNumForClass (MLClassPtr mlClass) const |
| VectorShort | GetUniqueListOfAssignments () const |
| kkint32 | MemoryConsumedEstimated () const |
| void | ParseToString (const KKStr &_toString, RunLog &_log) |
| Loads class assignments from string that was originally generated by ToString. More... | |
| void | Save (const KKStr &fileName, bool &successful) |
| KKStr | ToString () const |
Binds MLClass objects to the appropriate number that the Learning Algorithm expects.
This class will bind MLClass objects to the appropriate number that the learning algorithm knows for this class. When originally implementing this system, this info was kept in the MLClass object. This would cause problems when doing multilevel classification. The same MLClass might be known to the L.A. as one number in one level and another number in a different level. This caused us to have to maintain a separate instantiation of these classes on the SvmModel objects.
It is sub-classed from multimap<kkint16, MLClassPtr>. This allows for fast lookup by number. There is also a secondary index by MLClass. This allows us to do a fast lookup by class.
Definition at line 36 of file ClassAssignments.h.
| ClassAssignments::ClassAssignments | ( | ) |
Definition at line 25 of file ClassAssignments.cpp.
References ClassAssignments().
Referenced by ClassAssignments(), KKMLL::ModelOldSVM::ReadXML(), and KKMLL::SVMModel::SVMModel().
| ClassAssignments::ClassAssignments | ( | const MLClassList & | classes | ) |
Creates assignment for all classes in 'classes.
Constructs a list assigning a number to each class sequentially from 'classes'. Use this constructor if each class is treated uniquely by the learning algorithm.
| [in] | classes,List | of classes to make assignments for. |
| [in,out] | _log,Run | log to write messages to |
Definition at line 32 of file ClassAssignments.cpp.
References ClassAssignments().
Referenced by ClassAssignments(), and KKMLL::ModelOldSVM::TrainModel().
| void ClassAssignments::AddMLClass | ( | MLClassPtr | mlClass, |
| kkint16 | num, | ||
| RunLog & | log | ||
| ) |
Definition at line 56 of file ClassAssignments.cpp.
Referenced by ParseToString().
| MLClassPtr ClassAssignments::GetMLClass | ( | kkint16 | num | ) | const |
Definition at line 81 of file ClassAssignments.cpp.
Referenced by KKMLL::SVMModel::Predict(), KKMLL::SVMModel::PredictRaw(), KKMLL::SVMModel::ProbabilitiesByClass(), and KKMLL::SVMparam::ProbClassPairsInitialize().
| MLClassPtr ClassAssignments::GetMLClassByIndex | ( | size_t | idx | ) |
Definition at line 144 of file ClassAssignments.cpp.
| MLClassList ClassAssignments::GetMLClasses | ( | kkint16 | num | ) | const |
Definition at line 94 of file ClassAssignments.cpp.
| kkint16 ClassAssignments::GetNumForClass | ( | MLClassPtr | mlClass | ) | const |
Definition at line 167 of file ClassAssignments.cpp.
Referenced by KKMLL::FeatureEncoder::EncodeIntoSparseMatrix(), and KKMLL::SVMModel::Predict().
| VectorShort ClassAssignments::GetUniqueListOfAssignments | ( | ) | const |
Definition at line 111 of file ClassAssignments.cpp.
| kkint32 ClassAssignments::MemoryConsumedEstimated | ( | ) | const |
Definition at line 46 of file ClassAssignments.cpp.
Referenced by KKMLL::ModelOldSVM::MemoryConsumedEstimated(), and KKMLL::SVMModel::MemoryConsumedEstimated().
Loads class assignments from string that was originally generated by ToString.
| [in] | _toString,KKStr | containing class assignments info, will expect to be formated the way ToString() creates them. |
Definition at line 222 of file ClassAssignments.cpp.
References AddMLClass(), KKB::KKStr::Concat(), KKMLL::MLClass::CreateNewMLClass(), KKB::KKStr::Empty(), KKB::KKStr::ExtractToken(), KKB::KKStr::ExtractTokenInt(), and KKB::KKStr::KKStr().
| void ClassAssignments::Save | ( | const KKStr & | fileName, |
| bool & | successful | ||
| ) |
Definition at line 180 of file ClassAssignments.cpp.
| KKStr ClassAssignments::ToString | ( | ) | const |
Definition at line 198 of file ClassAssignments.cpp.
References KKB::KKStr::Concat().
Referenced by KKMLL::ModelOldSVM::WriteXML(), and KKMLL::SVMModel::WriteXML().