![]() |
KSquare Utilities
|
Represents a "Class" in the Machine Learning Sense. More...
#include <MLClass.h>
Public Member Functions | |
| kkint32 | ClassId () const |
| void | ClassId (kkint32 _classId) |
| float | CountFactor () const |
| void | CountFactor (float _countFactor) |
| const KKStr & | Description () const |
| void | Description (const KKStr &_description) |
| bool | IsAnAncestor (MLClassPtr c) const |
| bool | Mandatory () const |
| void | Mandatory (bool _mandatory) |
| MLClassPtr | MLClassForGivenHierarchialLevel (KKB::kkuint16 level) const |
| const KKStr & | Name () const |
| kkuint16 | NumHierarchialLevels () const |
| MLClassPtr | Parent () const |
| void | Parent (MLClassPtr _parent) |
| const KKStr & | ParentName () const |
| bool | StoredOnDataBase () const |
| void | StoredOnDataBase (bool _storedOnDataBase) |
| bool | Summarize () const |
| void | Summarize (bool _summarize) |
| KKStr | ToString () const |
| bool | UnDefined () const |
| void | UnDefined (bool _unDefined) |
| const KKStr & | UpperName () const |
| void | WriteXML (const KKStr &varName, std::ostream &o) const |
Static Public Member Functions | |
| static MLClassListPtr | BuildListOfDecendents (MLClassPtr parent) |
| static void | ChangeNameOfClass (MLClassPtr mlClass, const KKStr &newName, bool &changeSuccessful) |
| Changes the name of an existing class verifying that a duplicate does not get created. More... | |
| static MLClassPtr | CreateNewMLClass (const KKStr &_name, kkint32 _classId=-1) |
| Static method used to create a new instance of a MLClass object. More... | |
| static void | FinalCleanUp () |
| Call this as the last thing the application does, will delete all existing instances of 'MLClass'. More... | |
| static MLClassPtr | GetByClassId (kkint32 _classId) |
| static KKStr | GetClassNameFromDirName (const KKStr &subDir) |
| static MLClassPtr | GetUnKnownClassStatic () |
| static MLClassListPtr | GlobalClassList () |
| static void | ResetAllParentsToAllClasses () |
Friends | |
| class | KKQueue< MLClass > |
| class | MLClassList |
Represents a "Class" in the Machine Learning Sense.
Each instance of this class represents a single Class as used in Machine Learning sense. Each instance of 'FeatureVector' class will point to an instance of this class. There can only be one instance of each Class in memory. Specifically the 'name' field will be unique. This is enforced by making the constructor and destructor private. The only way to create a new instance of a 'MLClass' object is to call one of the static methods of 'CreateNewMLClass'. These methods will look for a instance of 'MLClass' that already exists. If one does not they will then create a new one.
Please refer to MLClassList at bottom of file. That class is the object you will most be using when dealing with Images. classes.
UmiClass and PicesClass There is a special relationship between this class and a class called 'UmiClass' and 'PicesClass in the 'UnManagedInterface' and PicesInterface libraries, ".net' Managed libraries'. These managed c++ versions of this class. There is a one-to-one correspondence between the two classes. When ever a instance of 'UmiClass' or 'PicesClass' get created they will automatic- ally call the static method 'MLClass::CreateNewMLClass' to get the unmanaged version of the class.
|
static |
Definition at line 145 of file MLClass.cpp.
References GlobalClassList(), KKMLL::MLClassList::MLClassList(), and KKMLL::MLClassList::PushOnBack().
|
static |
Changes the name of an existing class verifying that a duplicate does not get created.
Since the class name can not be duplicated and there is a nameIndex structure maintained by each 'MLClassList' instances we need to make sure the name is not already in use by another instance of 'mlClass'. This is done by first trying to update the 'nameIndex' in 'existingMLClasses' (list of all 'inageClass' instances in existence); if this is successful will then change the name in 'mlClass' and update all existing 'MLClassList' instances 'nameIndex' structures.
| [in,out] | mlClass | Class having its name changed; upon entry should contain its original name; if no other class already has its name it will be updated to the value in 'newName'. |
| [in] | newName | The new name that 'mlClass' is to receive. |
| [out] | changeSuccessful | Returns 'true' if name was changed; if set to false then the 'name' field in 'mlClass' will not be changed. |
Definition at line 181 of file MLClass.cpp.
References KKB::KKStr::Concat(), KKB::GoalKeeper::EndBlock(), Name(), and KKB::GoalKeeper::StartBlock().
|
inline |
From MySQL table Classes, '-1' indicates that not loaded from mysql table.
Definition at line 136 of file MLClass.h.
Referenced by CreateNewMLClass(), and KKMLL::MLClassList::LookUpByClassId().
|
inline |
Definition at line 137 of file MLClass.h.
Referenced by CreateNewMLClass().
|
inline |
|
inline |
Definition at line 140 of file MLClass.h.
Referenced by KKMLL::TrainingClass::TrainingClass(), and KKMLL::XmlElementMLClass::XmlElementMLClass().
|
static |
Static method used to create a new instance of a MLClass object.
Used to get pointer to existing MLClass object that already exists in 'existingMLClasses'. If one does not exist then a new MLClass object with this name will be created.
This is the only method that can actually create a MLClass instance. The idea is that there is only one MLClass object ever created for each class. All MLClassList container objects will point to
| [in] | _name | Name of class to be created. |
Definition at line 100 of file MLClass.cpp.
References KKMLL::MLClassList::AddMLClass(), ClassId(), KKB::KKStr::Concat(), KKB::GoalKeeper::EndBlock(), GlobalClassList(), KKMLL::MLClassList::LookUpByName(), KKB::GoalKeeper::StartBlock(), and KKB::KKStr::ToUpper().
Referenced by KKMLL::BinaryClassParms::CreateFromTabDelStr(), KKMLL::ClassProbList::CreateFromXMLStream(), KKMLL::MLClassList::GetMLClassPtr(), KKMLL::MLClassList::GetUnKnownClass(), GetUnKnownClassStatic(), KKMLL::MLClassList::Load(), MLClassForGivenHierarchialLevel(), KKMLL::MLClassIndexList::ParseClassIndexList(), KKMLL::ClassAssignments::ParseToString(), KKMLL::ClassProbList::ReadXML(), KKMLL::FeatureEncoder::ReadXML(), KKMLL::ModelDual::ReconcilePredictions(), KKMLL::XmlElementMLClass::XmlElementMLClass(), and KKMLL::XmlElementMLClassNameList::XmlElementMLClassNameList().
|
inline |
|
inline |
Definition at line 143 of file MLClass.h.
References KKB::KKStr::operator=().
Referenced by KKMLL::XmlElementMLClass::XmlElementMLClass().
|
static |
Call this as the last thing the application does, will delete all existing instances of 'MLClass'.
Call this at very end of program to clean up existingMLClasses.
Definition at line 269 of file MLClass.cpp.
References KKB::GoalKeeper::Destroy(), KKB::GoalKeeper::EndBlock(), KKMLL::FileDesc::FinalCleanUp(), KKMLL::FileDesc::FinalCleanUpRanAlready(), and KKB::GoalKeeper::StartBlock().
|
static |
Definition at line 137 of file MLClass.cpp.
References GlobalClassList(), and KKMLL::MLClassList::LookUpByClassId().
Definition at line 372 of file MLClass.cpp.
References KKB::KKStr::Concat(), KKB::KKStr::Len(), KKB::KKStr::LocateLastOccurrence(), KKB::KKStr::operator=(), KKB::KKStr::operator[](), KKB::osGetRootNameOfDirectory(), and KKB::KKStr::SubStrPart().
Referenced by KKMLL::FeatureFileIO::LoadInSubDirectoryTree().
|
static |
Definition at line 261 of file MLClass.cpp.
References CreateNewMLClass().
Referenced by KKMLL::FeatureFileIO::FeatureDataReSink(), and KKMLL::SizeDistribution::Increment().
|
static |
Definition at line 50 of file MLClass.cpp.
References KKB::GoalKeeper::EndBlock(), KKMLL::MLClassList::MLClassList(), and KKB::GoalKeeper::StartBlock().
Referenced by BuildListOfDecendents(), CreateNewMLClass(), GetByClassId(), and ResetAllParentsToAllClasses().
| bool MLClass::IsAnAncestor | ( | MLClassPtr | c | ) | const |
Returns true if 'c' is an ancestor
Definition at line 405 of file MLClass.cpp.
References IsAnAncestor().
Referenced by IsAnAncestor().
|
inline |
|
inline |
Definition at line 150 of file MLClass.h.
Referenced by KKMLL::XmlElementMLClass::XmlElementMLClass().
| MLClassPtr MLClass::MLClassForGivenHierarchialLevel | ( | KKB::kkuint16 | level | ) | const |
Definition at line 427 of file MLClass.cpp.
References KKB::KKStr::Concat(), CreateNewMLClass(), and KKB::KKStr::Split().
Referenced by KKMLL::FeatureVectorList::ExtractExamplesForHierarchyLevel(), KKMLL::TrainingConfiguration2::ExtractListOfClassesForAGivenHierarchialLevel(), KKMLL::MLClassList::ExtractListOfClassesForAGivenHierarchialLevel(), and KKMLL::TrainingConfiguration2::GenerateAConfiguraionForAHierarchialLevel().
|
inline |
Definition at line 154 of file MLClass.h.
Referenced by KKMLL::ConfusionMatrix2::AccuracyStr(), KKMLL::TrainingConfiguration2::AddATrainingClass(), KKMLL::MLClassList::AddMLClass(), ChangeNameOfClass(), KKMLL::BinaryClassParms::Class1Name(), KKMLL::BinaryClassParms::Class2Name(), KKMLL::FeatureVector::ClassName(), KKMLL::TrainingClass::ExpandedDirectory(), KKMLL::MLClassList::ExtractHTMLTableHeader(), KKMLL::FeatureFileIO::FeatureDataReSink(), KKMLL::ConfusionMatrix2::FMeasure(), KKMLL::TrainingConfiguration2::GenerateAConfiguraionForAHierarchialLevel(), KKMLL::SizeDistribution::Increment(), KKMLL::TrainingConfiguration2::LoadOtherClasssExamples(), KKMLL::FeatureVector::MLClassName(), KKMLL::ClassStatistic::Name(), KKMLL::TrainingClass::Name(), KKMLL::MLClassList::operator==(), ParentName(), KKMLL::FeatureVector::PredictedClassName(), KKMLL::SizeDistribution::PrintByClassCollumns(), KKMLL::ModelSvmBase::ProbabilitiesByClass(), KKMLL::ClassProbList::PushOnBack(), KKMLL::MLClassList::PushOnBack(), KKMLL::ClassProbList::PushOnFront(), KKMLL::MLClassList::PushOnFront(), KKMLL::ModelDual::ReconcilePredictions(), KKMLL::ModelDual::ReconcileProbAndVotes(), KKMLL::ModelSvmBase::RetrieveCrossProbTable(), KKMLL::ModelParamDual::ToCmdLineStr(), KKMLL::TrainingConfiguration2::TrainingConfiguration2(), KKMLL::FeatureEncoder::WriteXML(), and WriteXML().
| kkuint16 MLClass::NumHierarchialLevels | ( | ) | const |
|
inline |
|
inline |
Definition at line 158 of file MLClass.h.
Referenced by ResetAllParentsToAllClasses(), and KKMLL::XmlElementMLClass::XmlElementMLClass().
| const KKStr & MLClass::ParentName | ( | ) | const |
Definition at line 354 of file MLClass.cpp.
References KKB::KKStr::Concat(), KKB::KKStr::EmptyStr(), and Name().
|
static |
Definition at line 229 of file MLClass.cpp.
References KKB::GoalKeeper::EndBlock(), GlobalClassList(), KKMLL::MLClassList::LookUpByName(), Parent(), and KKB::GoalKeeper::StartBlock().
|
inline |
|
inline |
Definition at line 169 of file MLClass.h.
Referenced by KKMLL::XmlElementMLClass::XmlElementMLClass().
|
inline |
|
inline |
Definition at line 177 of file MLClass.h.
Referenced by KKMLL::XmlElementMLClass::XmlElementMLClass().
| KKStr MLClass::ToString | ( | ) | const |
Returns a KKStr representing this instance.
This string will later be written to a file.
Definition at line 364 of file MLClass.cpp.
References KKB::KKStr::Concat(), and KKB::KKStr::KKStr().
|
inline |
Definition at line 183 of file MLClass.h.
Referenced by KKMLL::FeatureFileIO::FeatureDataReSink(), and KKMLL::MLClassList::Load().
|
inline |
|
inline |
Returns name capitalized.
Definition at line 155 of file MLClass.h.
Referenced by KKMLL::ClassStatisticList::ClassStatisticSortComparrison::operator()(), KKMLL::ClassStatisticList::ClassStatSortByCount::operator()(), KKMLL::MLClassList::MLClassNameComparison::operator()(), KKMLL::FeatureVectorList::ClassNameComparrison::operator()(), and KKMLL::FeatureVectorList::ClassNameComparrisonReversed::operator()().
| void MLClass::WriteXML | ( | const KKStr & | varName, |
| std::ostream & | o | ||
| ) | const |
Definition at line 448 of file MLClass.cpp.
References KKB::XmlTag::AddAtribute(), KKB::KKStr::Empty(), Name(), KKB::XmlTag::tagEmpty, KKB::XmlTag::WriteXML(), and KKB::XmlTag::XmlTag().
Referenced by KKMLL::ModelParamDual::WriteXML(), KKMLL::MLClassList::WriteXML(), and KKMLL::XmlElementMLClass::WriteXML().
|
friend |