![]() |
KSquare Utilities
|
Used to maintain multiple orderings of a single list of FeatureVector objects. More...
#include <Orderings.h>
Public Types | |
| typedef Orderings * | OrderingsPtr |
Public Member Functions | |
| Orderings (const FeatureVectorListPtr _data, kkuint32 _numOfOrderings, kkuint32 _numOfFolds, RunLog &_log) | |
| Constructs Orderings object from ImageFeatursList object. More... | |
| Orderings (const KKStr &_featureFileName, FeatureFileIOPtr _driver, RunLog &_log, bool &cancelFlag) | |
| Constructs Orderings of a FeatureVectorList from a previous construction that was saved in a data file. More... | |
| Orderings (const FeatureVectorListPtr _data, const KKStr &_indexFileName, kkuint32 _numOfOrderings, kkuint32 _numOfFolds, RunLog &_log) | |
| Constructs a Orderings object from a FeatureLectorList object. More... | |
| Orderings (FeatureVectorListPtr _data, RunLog &_log) | |
| Constructs a Orderings objects for a specified FeatureVectorList using a previously built Orderings data index file. More... | |
| ~Orderings () | |
| FeatureVectorListPtr | Data () const |
| const KKStr & | FeatureFileName () const |
| const FileDescPtr | FileDesc () const |
| const KKStr & | IndexFileName () const |
| const MLClassListPtr | MLClasses () const |
| kkuint32 | NumOfFolds () const |
| kkuint32 | NumOfOrderings () const |
| const FeatureVectorListPtr | Ordering (kkuint32 orderingIdx) const |
| void | Save () |
| void | Save (const KKStr &_indexFileName, RunLog &_log) |
| kkuint32 | Size () const |
| bool | Valid () const |
Static Public Member Functions | |
| static OrderingsPtr | CreateOrderingsObjFromFileIfAvaliable (const FeatureVectorListPtr _data, kkuint32 _numOfOrderings, kkuint32 _numOfFolds, RunLog &_log) |
| Constructs a Orderings object for a specified FeatureVectorList. More... | |
Used to maintain multiple orderings of a single list of FeatureVector objects.
Will maintain multiple orderings of a single FeatureVectorList. These orderings will be saved in a text file for recall later. This will allow the user to be able to repeat experiments using the same ordering of data again. The Idea is that the 1st time this orderings is created the order will be randomly driven with Stratification by Class. This ordering will then be saved in data Files for future recall. More than one order can be maintained for a single list. An example of a good use of this is RandomSplits.
Definition at line 58 of file Orderings.h.
| typedef Orderings* KKMLL::Orderings::OrderingsPtr |
Definition at line 62 of file Orderings.h.
| Orderings::Orderings | ( | const FeatureVectorListPtr | _data, |
| kkuint32 | _numOfOrderings, | ||
| kkuint32 | _numOfFolds, | ||
| RunLog & | _log | ||
| ) |
Constructs Orderings object from ImageFeatursList object.
Use this when an existing list does not exist. Will create 'numOfOrderings' separate lists of 'data' that are randomly ordered and stratified by 'numOfFolds'.
| [in] | _data | ImagFeaturesList object, |
| [in] | _numOfOrderings | Number of separate orderings of data need. |
| [in] | _numOfFolds | Used to help stratify data in each fold. |
Definition at line 25 of file Orderings.cpp.
References KKB::KKStr::Empty(), KKMLL::FeatureVectorList::ExtractListOfClasses(), KKMLL::FeatureVectorList::FeatureVectorList(), KKMLL::FeatureVectorList::FileDesc(), KKMLL::FeatureVectorList::FileName(), KKB::KKStr::operator+(), KKB::KKStr::operator=(), and KKB::osRemoveExtension().
| Orderings::Orderings | ( | const KKStr & | _featureFileName, |
| FeatureFileIOPtr | _driver, | ||
| RunLog & | _log, | ||
| bool & | cancelFlag | ||
| ) |
Constructs Orderings of a FeatureVectorList from a previous construction that was saved in a data file.
Will load object from the Feature File '_featureFileName' and retrieve the different orderings from a separate index file who's name will be osExtention (FeatureFileName) + ".idx". The load routine will validate that all FeatureVector instances are accounted for in each ordering. If the index file does not exist it then the 'successful' flag will bet to false.
| [in] | _featureFileName | File to load FeatureVector' objects from. This will be used as master list for 'Orderings'. |
| [in] | _driver | Feature File driver to utilize. |
| [in] | _log | Log file to write messages to. |
| [in] | v | If flag turns to 'TRUE' then will terminate the load process and return to caller. |
Definition at line 120 of file Orderings.cpp.
References KKMLL::FeatureVectorList::FileDesc(), KKB::KKStr::KKStr(), KKMLL::FeatureFileIO::LoadFeatureFile(), KKMLL::MLClassList::MLClassList(), KKB::KKStr::operator+(), KKB::KKStr::operator=(), and KKB::osRemoveExtension().
| Orderings::Orderings | ( | const FeatureVectorListPtr | _data, |
| const KKStr & | _indexFileName, | ||
| kkuint32 | _numOfOrderings, | ||
| kkuint32 | _numOfFolds, | ||
| RunLog & | _log | ||
| ) |
Constructs a Orderings object from a FeatureLectorList object.
Will use 'data' as master list of FeatureVector objects.The orderings will be loaded from 'indexFileName'. It is expected that the size of the files will match. The load routine will validate that all FeatureVector objects are accounted for in each ordering.
| [in] | _data | Master List of FeatureVector instances. |
| [in] | _indexFileName | File where orderings of 'data' are to be loaded from. |
| [in] | _numOfOrderings | |
| [in] | _numOfFolds |
Definition at line 49 of file Orderings.cpp.
References KKMLL::FeatureVectorList::ExtractListOfClasses(), KKMLL::FeatureVectorList::FeatureVectorList(), KKMLL::FeatureVectorList::FileDesc(), KKB::KKStr::KKStr(), KKB::osFileExists(), and Save().
Referenced by CreateOrderingsObjFromFileIfAvaliable().
| Orderings::Orderings | ( | FeatureVectorListPtr | _data, |
| RunLog & | _log | ||
| ) |
Constructs a Orderings objects for a specified FeatureVectorList using a previously built Orderings data index file.
Will use FileName from "data" parameter to derive both 'featureFileName' and 'indexFileName' using the 'FileName' method from FeatureVectorList. It is expected that a separate index file by the name osDeletExtention (FeatureFileName) + ".idx" will exist. The orderings will be loaded from that file.
| [in] | _data | FeatureVectorList that we want different orderings of. |
| [in] | _log | Logger. |
Definition at line 77 of file Orderings.cpp.
References KKB::KKStr::Empty(), KKMLL::FeatureVectorList::ExtractListOfClasses(), KKMLL::FeatureVectorList::FeatureVectorList(), KKMLL::FeatureVectorList::FileDesc(), KKMLL::FeatureVectorList::FileName(), KKB::KKStr::KKStr(), KKB::KKStr::operator+(), KKB::KKStr::operator=(), and KKB::osRemoveExtension().
| Orderings::~Orderings | ( | ) |
Definition at line 185 of file Orderings.cpp.
|
static |
Constructs a Orderings object for a specified FeatureVectorList.
Will use FileName from "_data" parameter to derive both 'featureFileName' and 'indexFileName' using the 'FileName' method from FeatureVectorList. If a separate Index file does not exist it will randomly create orderings and save the orderings in a new Index file.
| [in] | _data | FeatureVectorList that we want different orderings of. |
| [in] | _numOfOrderings | Expected number of orderings. |
| [in] | _numOfFolds | Number of folds each ordering should be stratified by. |
| [in] | _log | Logger. |
Definition at line 193 of file Orderings.cpp.
References KKB::KKStr::Concat(), KKB::KKStr::Empty(), KKMLL::FeatureVectorList::FileName(), NumOfFolds(), NumOfOrderings(), KKB::KKStr::operator+(), Orderings(), KKB::osRemoveExtension(), Save(), and Valid().
|
inline |
Definition at line 163 of file Orderings.h.
|
inline |
Definition at line 164 of file Orderings.h.
|
inline |
Definition at line 165 of file Orderings.h.
|
inline |
Definition at line 167 of file Orderings.h.
|
inline |
Definition at line 166 of file Orderings.h.
Referenced by KKMLL::CrossValidationMxN::RunTrainAndTest(), and KKMLL::CrossValidationMxN::RunValidations().
|
inline |
Definition at line 168 of file Orderings.h.
Referenced by CreateOrderingsObjFromFileIfAvaliable().
|
inline |
Definition at line 169 of file Orderings.h.
Referenced by CreateOrderingsObjFromFileIfAvaliable().
| const FeatureVectorListPtr Orderings::Ordering | ( | kkuint32 | orderingIdx | ) | const |
Definition at line 614 of file Orderings.cpp.
Referenced by KKMLL::CrossValidationMxN::RunTrainAndTest(), and KKMLL::CrossValidationMxN::RunValidations().
| void Orderings::Save | ( | ) |
Definition at line 551 of file Orderings.cpp.
References KKB::KKStr::Concat(), KKB::KKStr::Empty(), and KKB::KKStr::operator=().
Referenced by CreateOrderingsObjFromFileIfAvaliable(), Orderings(), and Save().
Definition at line 528 of file Orderings.cpp.
References KKB::KKStr::Empty(), KKB::KKStr::operator=(), KKB::osWaitForEnter(), and Save().
|
inline |
Definition at line 170 of file Orderings.h.
|
inline |
Definition at line 171 of file Orderings.h.
Referenced by CreateOrderingsObjFromFileIfAvaliable().