25 using namespace KKMLL;
54 _log.Level (10) << endl << endl
55 <<
"FeatureFileIOArff::LoadFile ***ERROR*** ARFF read Functionality not implemented." << endl
58 _errorMessage
= "ARFF read functionality not implemented.";
77 _log.Level (10) << endl << endl
78 <<
"FeatureFileIOArff::LoadFile ***ERROR*** ARFF read Functionality not implemented." << endl
81 _errorMessage
= "ARFF read functionality not implemented.";
89 const KKStr& _fileName,
99 _log.Level (20) <<
"FeatureFileIOArff::SaveFile FileName[" << _fileName <<
"]" << endl;
101 _numExamplesWritten = 0;
108 _out <<
"% ARFF Format Definition: http://www.cs.waikato.ac.nz/~ml/weka/arff.html" << endl
110 <<
"% FileName [" << _fileName <<
"]" << endl
111 <<
"% DateWritten [" << osGetLocalDateTime () <<
"]" << endl
112 <<
"% SelectedFeatures [" << _selFeatures.ToString () <<
"]" << endl
113 <<
"% TotalRecords [" << _data.QueueSize () <<
"]" << endl
114 <<
"% NumAttributes [" << _selFeatures.NumOfFeatures () <<
"]" << endl
116 <<
"% ClassName" <<
"\t" <<
"Count" << endl;
119 KKStr classListStr (classStatistics->QueueSize () * 15);
120 for (x = 0; x < classStatistics->QueueSize (); x++)
123 _out <<
"% " << classStatistic->Name () <<
"\t" << classStatistic->Count () << endl;
125 classListStr <<
", ";
126 classListStr << classStatistic
->Name ();
130 <<
"% Total" <<
"\t" << _data.QueueSize () << endl
133 <<
"@relation image_features" << endl
141 _out <<
"@attribute " 166 _out <<
"@attribute ExampleFileName " <<
"string" << endl;
168 _out <<
"@attribute Classes? { " << classListStr <<
" }" << endl;
174 <<
"% " << _data.QueueSize () <<
" Instances" << endl
176 delete classStatistics;
180 kkint32 numOfDigistsNeededInRowMask = Min (1, kkint32 (log10 (
float (_data.QueueSize ()))) + 1);
185 FeatureVectorPtr example = NULL;
188 for (idx = 0; idx < _data.QueueSize (); idx++)
190 example = _data.IdxToPtr (idx);
208 _out << imageFileName <<
",";
211 _numExamplesWritten++;
const KKStr & Name() const
const KKStr & GetNominalValue(kkint32 code) const
Returns the nominal value for the given ordinal value.
float FeatureData(kkint32 featureNum) const
Support the writing of ARFF Formatted Feature Files.
KKStr & operator=(const char *src)
const FileDescPtr FileDesc() const
FeatureNumList const FeatureNumListConst
ClassStatistic * ClassStatisticPtr
unsigned __int32 kkuint32
Container class for FeatureVector derived objects.
kkuint16 operator[](kkint32 idx) const
Returns back the selected feature.
KKStr operator+(const char *left, const KKStr &right)
kkint32 NumOfFeatures() const
Base class for all FeatureFileIO classes.
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of 'std::string' strings.
ClassStatisticListPtr GetClassStatistics() const
Returns the number of FeatureVectors per class.
bool operator==(const KKStr &right) const
KKStr StrFormatInt(kkint32 val, const char *mask)
ClassStatisticList * ClassStatisticListPtr
AttributeType Type() const
std::ostream &__cdecl operator<<(std::ostream &os, const KKStr &str)
const KKMLL::AttributePtr * CreateAAttributeTable() const
const char * Str() const
Returns a pointer to a ascii string.
void RightPad(kkint32 width, char ch= ' ')
Pads string on the right side with specified character so that the string will be of specified length...
Used for logging messages.
void EncodeProblem(const struct svm_paramater ¶m, struct svm_problem &prob_in, struct svm_problem &prob_out)
MLClassList * MLClassListPtr
KKStr osGetRootNameWithExtension(const KKStr &fullFileName)
const KKStr & ClassName() const
Name of class that this example is assigned to.
Maintains a list of MLClass instances.
kkint32 Cardinality() const
Returns back the cardinality of the attribute; the number of possible values it can take...
FeatureFileIO(const KKStr &_driverName, bool _canRead, bool _canWrite)
const KKStr & ExampleFileName() const
Name of file that this FeatureVector was computed from.
volatile const bool VolConstBool