25 using namespace KKMLL;
127 for (
auto temp: *
this)
129 if (temp->name.EqualIgnoreCase (_name))
171 o <<
"\"" << name <<
"\"," << count;
177 o <<
"," << sizeBuckets[bucket];
187 o <<
"\"" << name <<
"\"" <<
"\t" << count;
193 o <<
"\t" << sizeBuckets[bucket];
223 bucketCount (_bucketCount),
224 bucketSize (_bucketSize),
231 log.Level (-1) << endl << endl << endl
232 <<
"SizeDistribution::SizeDistribution *** Invalid Bucket Size[" << bucketSize <<
"] ***" << endl
250 ClassTotalsList::const_iterator cIDX;
251 for (cIDX = totals->begin (); cIDX != totals->end (); cIDX++)
275 totals->PushOnBack (classTotals);
287 PrintFormatedHeader (o);
295 for (idx = 0; idx < totals->QueueSize (); idx++)
297 classTotals = totals->IdxToPtr (idx);
321 for (idx = 0; idx < totals->QueueSize (); idx++)
323 classTotals = totals->IdxToPtr (idx);
337 PrintTabDelHeader (o);
345 for (idx = 0; idx < totals->QueueSize (); idx++)
347 classTotals = totals->IdxToPtr (idx);
364 o <<
"Class Name TOTAL";
368 for (bucket = 0; bucket < (bucketCount - 1); bucket++)
370 imageSize = imageSize + bucketSize;
372 sizeStr << imageSize;
384 o <<
"================== =====";
386 for (bucket = 0; bucket < bucketCount; bucket++)
398 o <<
"\"Class Name\",Sum,";
403 for (bucket = 0; bucket < (bucketCount - 1); bucket++)
405 imageSize = imageSize + bucketSize;
406 o <<
"," << imageSize;
409 o <<
",>" << imageSize;
419 o <<
"\"Class Name\"" <<
"\t" <<
"Sum";
424 for (bucket = 0; bucket < (bucketCount - 1); bucket++)
426 imageSize = imageSize + bucketSize;
427 o <<
"\t" << imageSize;
430 o <<
"\t" <<
">" << imageSize;
447 MLClassList::const_iterator cIDX;
455 for (
kkint32 bucketIDX = 0; bucketIDX < bucketCount; bucketIDX++)
458 for (cIDX = classes->begin (); cIDX != classes->end (); cIDX++)
468 firstBucket = bucketIDX;
469 lastBucket = bucketIDX;
476 <<
"SizeDistribution::PrintByClassCollumns *** There is no SizeDistribution Data ***" << endl
482 VectorInt finalTotals (classes->size (), 0);
487 o <<
"" <<
"\t" <<
"" <<
"\t" << hd1 <<
"\t" <<
"" << endl
488 <<
"" <<
"\t" <<
"Scan" <<
"\t" << hd2 <<
"\t" <<
"Bucket" << endl
489 <<
"Depth" <<
"\t" <<
"Lines" <<
"\t" << hd3 <<
"\t" <<
"Total" << endl;
492 kkint32 imageSize = firstBucket * bucketSize;
494 for (
kkint32 bucketIDX = firstBucket; bucketIDX <= lastBucket; bucketIDX++)
496 kkint32 nextImageSize = imageSize + bucketSize;
497 kkuint64 scanLinesDepthForThisBucket = 0;
498 if (scanLinesPerMeterDepth != NULL)
500 for (kkint32 x = imageSize; x < Min (nextImageSize, (kkint32)scanLinesPerMeterDepth->size ()); x++)
501 scanLinesDepthForThisBucket += (*scanLinesPerMeterDepth)[x];
504 o << imageSize <<
"\t" << scanLinesDepthForThisBucket;
505 totalScanLines += scanLinesDepthForThisBucket;
510 for (cIDX = classes->begin (); cIDX != classes->end (); cIDX++)
517 o <<
"\t" << qtyThisBucket;
519 bucketTotal += qtyThisBucket;
520 finalTotals[intIDX] += qtyThisBucket;
521 grandTotal += qtyThisBucket;
526 imageSize = nextImageSize;
527 o <<
"\t" << bucketTotal << endl;
532 <<
"FinalTotals" <<
"\t" << totalScanLines;
533 for (
kkuint32 x = 0; x < classes->size (); x++)
535 o <<
"\t" << finalTotals[x];
537 o <<
"\t" << grandTotal << endl
541 delete classes; classes = NULL;
void PrintTabDelLine(ostream &_outFile)
void LeftPad(kkint32 width, uchar ch= ' ')
pads the string with enough 'ch' characters on the left side until the string is as long as 'width' c...
ClassTotalsList(bool _owner)
std::vector< int > VectorInt
Represents a "Class" in the Machine Learning Sense.
static MLClassPtr GetUnKnownClassStatic()
void Increment(MLClassPtr mlClass, kkint32 size)
void PrintFormatedLine(ostream &_outFile)
unsigned __int32 kkuint32
void PrintCSVLine(ostream &_outFile)
void PrintTabDelDistributionMatrix(ostream &_outFile) const
ClassTotals * ClassTotalsPtr
ClassTotals::ClassTotalsPtr LookUp(KKStr _name)
SizeDistribution(kkint32 _bucketCount, kkint32 _bucketSize, RunLog &_log)
KKStr(const KKStr &str)
Copy Constructor.
ClassTotals(KKStr _name, kkint32 _bucketCount, kkint32 _bucketSize)
virtual void PushOnBack(MLClassPtr mlClass)
void PrintByClassCollumns(ostream &o, VectorUlong *scanLinesPerMeter) 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'.
void ExtractThreeTitleLines(KKStr &titleLine1, KKStr &titleLine2, KKStr &titleLine3) const
Using the class names create three title lines where we split names by "_" characters between the thr...
kkint32 BucketCount(kkint32 idx)
void AddIn(ClassTotalsPtr classTotals)
unsigned __int64 kkuint64
const KKStr & Name() const
std::ostream &__cdecl operator<<(std::ostream &os, const KKStr &str)
static MLClassPtr CreateNewMLClass(const KKStr &_name, kkint32 _classId=-1)
Static method used to create a new instance of a MLClass object.
void RightPad(kkint32 width, char ch= ' ')
Pads string on the right side with specified character so that the string will be of specified length...
KKStr & operator=(kkint32 right)
Used to keep track of examples by size; typically used by 'CrossValidation'; for each example predict...
Used for logging messages.
void EncodeProblem(const struct svm_paramater ¶m, struct svm_problem &prob_in, struct svm_problem &prob_out)
MLClassList * MLClassListPtr
void Increment(kkint32 size)
Maintains a list of MLClass instances.
void PrintFormatedDistributionMatrix(ostream &_outFile) const
void PrintCSVDistributionMatrix(ostream &_outFile) const
std::vector< ulong > VectorUlong