24 using namespace KKMLL;
103 KKStr& _errorMessage,
109 KKStr classNameAttribute;
127 _log.Level (-1) << endl << endl
128 <<
"FeatureFileIODstWeb::GetFileDesc ***ERROR*** File is empty." << endl
140 _log.Level (-1) << endl << endl
141 <<
"FeatureFileIODstWeb::GetFileDesc *** ERROR *** First Line is not Class Identifier." << endl
150 if (leftSide
!= "CLASS")
152 _log.Level (-1) << endl << endl
153 <<
"FeatureFileIODstWeb::GetFileDesc *** ERROR *** First Line is not Class Identifier." << endl
161 classNameAttribute
= rightSide;
168 vector<AttrDescLinePtr> attributes;
189 attributes.push_back (a);
195 sort (attributes.begin (), attributes.end (), c);
198 for (x = 0; x < attributes.size (); x++)
200 bool alreadyExists =
false;
201 fileDesc->AddAAttribute (attributes[x]->code, AttributeType::Nominal, alreadyExists);
204 _log.Level (-1) << endl
206 <<
"FeatureFileIODstWeb::GetFileDesc *** ERROR *** Attribute Code Occurs more than once" << endl
207 <<
" code [" << attributes[x]->code <<
"]." << endl
218 for (x = 0; x < attributes.size (); x++)
219 delete attributes[x];
234 KKStr& _errorMessage,
238 _log.Level (20) <<
"FeatureFileIODstWeb::LoadFile FileName[" << _fileName <<
"]" << endl;
266 delete attributeTable;
267 _errorMessage
= "no 'C' line detected.";
293 for (x = 0; x < numOfFeatures; x++)
307 if (idStr
== classNameAttributeUpper)
316 _errorMessage <<
"Invalid Attribute[" << idStr
+ "] Line[" << lineCount <<
"]";
317 _log.Level (-1) << endl
318 <<
"FeatureFileIODstWeb::LoadFile ***ERROR***" << endl
320 <<
" " << _errorMessage << endl
337 delete [] attributeTable;
347 const KKStr& _fileName,
353 KKStr& _errorMessage,
357 _log.Level (-1) << endl << endl
358 <<
"FeatureFileIODstWeb::SaveFile FileName[" << _fileName <<
"] ***ERROR***." << endl
360 <<
" SaveFile not implemented." << endl
363 _errorMessage
= "FeatureFileIODstWeb::SaveFile Not Implemented.";
365 _numExamplesWritten = 0;
KKStr(kkint32 size)
Creates a KKStr object that pre-allocates space for 'size' characters.
void ExampleFileName(const KKStr &_exampleFileName)
Name of source of feature vector, ex: file name of image that the feature vector was computed from...
void PushOnBack(FeatureVectorPtr image)
Overloading the PushOnBack function in KKQueue so we can monitor the Version and Sort Order...
Provides a detailed description of the attributes of a dataset.
kkuint32 NumOfFields() const
virtual FileDescPtr GetFileDesc(const KKStr &_fileName, istream &_in, MLClassListPtr _classList, kkint32 &_estSize, KKStr &_errorMessage, RunLog &_log)
KKStr & TrimRight(const char *whiteSpaceChars="\n\r\t ")
FeatureVector(kkint32 _numOfFeatures)
KKStr ExtractToken(const char *delStr="\n\t\r ")
kkint32 GetNominalCode(const KKStr &nominalValue) const
KKStr & operator=(const char *src)
FeatureNumList const FeatureNumListConst
KKStr operator+(const char *right) const
void GetLine(std::istream &_in, KKStr &_line, bool &_eof)
unsigned __int32 kkuint32
void AddFeatureData(kkint32 _featureNum, float _featureData)
FeatureVectorList(FileDescPtr _fileDesc, bool _owner)
Will create a new empty list of FeatureVector's.
KKStr & operator=(KKStr &&src)
bool operator!=(const char *rtStr) const
Container class for FeatureVector derived objects.
KKStr(const KKStr &str)
Copy Constructor.
void TrimLeft(const char *whiteSpaceChars="\n\r\t ")
Base class for all FeatureFileIO classes.
bool operator()(AttrDescLinePtr p1, AttrDescLinePtr p2)
KKStr SubStrPart(kkint32 firstChar, kkint32 lastChar) const
returns a SubString consisting of all characters starting at index 'firstChar' and ending at 'lastInd...
virtual void SaveFile(FeatureVectorList &_data, const KKStr &_fileName, FeatureNumListConst &_selFeatures, ostream &_out, kkuint32 &_numExamplesWritten, VolConstBool &_cancelFlag, bool &_successful, KKStr &_errorMessage, RunLog &_log)
const KKStr & ClassNameAttribute() const
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of 'std::string' strings.
void Upper()
Converts all characters in string to their Upper case equivalents via 'toupper'.
kkint32 LocateCharacter(char ch) const
Returns index of 1st occurrence of 'ch' otherwise -1.
void AddANominalValue(const KKStr &nominalValue, bool &alreadyExist, RunLog &log)
void MLClass(MLClassPtr _mlClass)
Assign a class to this example.
bool operator==(const KKStr &right) const
const KKMLL::AttributePtr * CreateAAttributeTable() const
kkint32 GetFieldNumFromAttributeName(const KKStr &attributeName) const
KKStr & operator=(const KKStr &src)
Used for logging messages.
void EncodeProblem(const struct svm_paramater ¶m, struct svm_problem &prob_in, struct svm_problem &prob_out)
bool operator<(const KKStr &right) const
MLClassList * MLClassListPtr
virtual MLClassPtr GetMLClassPtr(const KKStr &_name)
return pointer to instance with '_name'; if none exists, create one and add to list.
Maintains a list of MLClass instances.
Represents a Feature Vector of a single example, labeled or unlabeled.
KKStr SubStrPart(kkint32 firstChar) const
returns a SubString consisting of all characters starting at index 'firstChar' until the end of the s...
FeatureFileIO(const KKStr &_driverName, bool _canRead, bool _canWrite)
KKStr osGetRootName(const KKStr &fullFileName)
volatile const bool VolConstBool