MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.basecode.BucketCollection Class Reference

The BucketCollection contains a set of Buckets. More...

Inheritance diagram for MyCaffe.basecode.BucketCollection:

Public Types

enum  OUTPUT_FMT { NONE , TXT , CSV }
 Specifies the output format used when creating a distribution string. More...
 

Public Member Functions

 BucketCollection (double fMin, double fMax, int nCount)
 The constructor. More...
 
 BucketCollection (List< int > rgVocab)
 The constructor. More...
 
 BucketCollection (bool bIsReal)
 The constructor. More...
 
Bucket GetBucketWithMaxCount ()
 Returns the bucket with the highest count. More...
 
Tuple< double, double > GetRange ()
 Returns the numeric range that all buckets fall into. More...
 
int Add (double fVal)
 Finds the correct Bucket and adds the value to it. More...
 
void Reduce (double dfPct)
 Reduces the buckets to only include those that have a count that are within 1.0 - dfPct of the maximum bucket count. More...
 
double Translate (double fVal)
 Finds the Bucket associated with the value and returns the Bucket's average value. More...
 
int FindIndex (double dfVal)
 Finds the index of the Bucket containing the value. More...
 
double GetValueAt (int nIdx, bool bUseMidPoint=false)
 Returns the average of the Bucket at a given index. More...
 
bool UnBucketize (string strName, List< double[]> rgrgData, Log log, CancelEvent evtCancel)
 The UnBucketize method converts all Data received into their respective Bucket average values. More...
 
byte[] ToByteStream ()
 Converts the BucketCollection into a byte stream. More...
 
string ToDistributionString (OUTPUT_FMT fmt=OUTPUT_FMT.NONE, int nMaxDots=30, string strFmt="0.00000", bool bIncludePercents=false)
 Returns the distribution of buckets as a percentage for each time a bucket was hit. More...
 
IEnumerator< BucketGetEnumerator ()
 Returns the enumerator used in foreach loops. More...
 

Static Public Member Functions

static BucketCollection Bucketize (string strName, int nBucketCount, SimpleDatum sd, Log log, CancelEvent evtCancel, double? dfMin=null, double? dfMax=null)
 The Bucketize method adds all values within a SimpleDatum to a new BucketCollection. More...
 
static BucketCollection FromByteStream (byte[] rg)
 Converts a byte stream into a BucketCollection. More...
 

Properties

bool IsDataReal [getset]
 Get/set whether or not the Buckets hold Real values. More...
 
int Count [get]
 Returns the number of Buckets. More...
 
Bucket this[int nIdx] [get]
 Returns the bucket at a given index. More...
 
int TotalCount [get]
 Returns the total count across all buckets. More...
 

Detailed Description

The BucketCollection contains a set of Buckets.

Definition at line 164 of file BucketCollection.cs.

Member Enumeration Documentation

◆ OUTPUT_FMT

Specifies the output format used when creating a distribution string.

Enumerator
NONE 

No special output formatting used.

TXT 

Format for a text file.

CSV 

Format for a CSV file.

Definition at line 172 of file BucketCollection.cs.

Constructor & Destructor Documentation

◆ BucketCollection() [1/3]

MyCaffe.basecode.BucketCollection.BucketCollection ( double  fMin,
double  fMax,
int  nCount 
)

The constructor.

Parameters
fMinSpecifies the overall minimum of all Buckets.
fMaxSpecifies the overall maximum of all Buckets.
nCountSpecifies the number of Buckets to use.

Definition at line 194 of file BucketCollection.cs.

◆ BucketCollection() [2/3]

MyCaffe.basecode.BucketCollection.BucketCollection ( List< int >  rgVocab)

The constructor.

Parameters
rgVocabSpecifies an array of vocabulary values to add into Buckets.

Definition at line 215 of file BucketCollection.cs.

◆ BucketCollection() [3/3]

MyCaffe.basecode.BucketCollection.BucketCollection ( bool  bIsReal)

The constructor.

Parameters
bIsRealSpecifies that the Buckets are to hold Real values.

Definition at line 234 of file BucketCollection.cs.

Member Function Documentation

◆ Add()

int MyCaffe.basecode.BucketCollection.Add ( double  fVal)

Finds the correct Bucket and adds the value to it.

Parameters
fValSpecifies the value to add.
Returns
The index of the bucket for which the value was added is returned.

Definition at line 307 of file BucketCollection.cs.

◆ Bucketize()

static BucketCollection MyCaffe.basecode.BucketCollection.Bucketize ( string  strName,
int  nBucketCount,
SimpleDatum  sd,
Log  log,
CancelEvent  evtCancel,
double?  dfMin = null,
double?  dfMax = null 
)
static

The Bucketize method adds all values within a SimpleDatum to a new BucketCollection.

Parameters
strNameSpecifies the name to use when writing status information.
nBucketCountSpecifies the number of Buckets to use.
sdSpecifies the SimpleDatum containing the data to add.
logSpecifies the output log.
evtCancelSpecifies the CancelEvent used to cancel the bucketizing process.
dfMinOptionally, specifies a overall minimum to use in the BucketCollection, when missing this is calculated from the SimpleDatum.
dfMaxOptionally, specifies a overall maximum to use in the BucketCollection, when missing this is calculated from the SimpleDatum.
Returns

Definition at line 407 of file BucketCollection.cs.

◆ FindIndex()

int MyCaffe.basecode.BucketCollection.FindIndex ( double  dfVal)

Finds the index of the Bucket containing the value.

Parameters
dfValSpecifies the value to look for.
Returns
The Bucket index is returned.

Definition at line 371 of file BucketCollection.cs.

◆ FromByteStream()

static BucketCollection MyCaffe.basecode.BucketCollection.FromByteStream ( byte[]  rg)
static

Converts a byte stream into a BucketCollection.

Parameters
rgSpecifies the byte stream.
Returns
The new BucketCollection is returned.

Definition at line 544 of file BucketCollection.cs.

◆ GetBucketWithMaxCount()

Bucket MyCaffe.basecode.BucketCollection.GetBucketWithMaxCount ( )

Returns the bucket with the highest count.

Returns
The bucket with the highest count is returned.

Definition at line 270 of file BucketCollection.cs.

◆ GetEnumerator()

IEnumerator< Bucket > MyCaffe.basecode.BucketCollection.GetEnumerator ( )

Returns the enumerator used in foreach loops.

Returns
The enumerator is returned.

Definition at line 638 of file BucketCollection.cs.

◆ GetRange()

Tuple< double, double > MyCaffe.basecode.BucketCollection.GetRange ( )

Returns the numeric range that all buckets fall into.

Returns
A tuple containing the min,max is returned.

Definition at line 294 of file BucketCollection.cs.

◆ GetValueAt()

double MyCaffe.basecode.BucketCollection.GetValueAt ( int  nIdx,
bool  bUseMidPoint = false 
)

Returns the average of the Bucket at a given index.

Parameters
nIdxSpecifies the index.
bUseMidPointOptionally specifies to use the bucket midpoint instead of the average.
Returns
The Bucket average is returned.

Definition at line 388 of file BucketCollection.cs.

◆ Reduce()

void MyCaffe.basecode.BucketCollection.Reduce ( double  dfPct)

Reduces the buckets to only include those that have a count that are within 1.0 - dfPct of the maximum bucket count.

Parameters
dfPctSpecifies the threshold percent where all buckets with a count >= Max Count * (1.0 - dfPct) are kept.

Definition at line 335 of file BucketCollection.cs.

◆ ToByteStream()

byte[] MyCaffe.basecode.BucketCollection.ToByteStream ( )

Converts the BucketCollection into a byte stream.

Returns
The byte stream is returned.

Definition at line 522 of file BucketCollection.cs.

◆ ToDistributionString()

string MyCaffe.basecode.BucketCollection.ToDistributionString ( OUTPUT_FMT  fmt = OUTPUT_FMT.NONE,
int  nMaxDots = 30,
string  strFmt = "0.00000",
bool  bIncludePercents = false 
)

Returns the distribution of buckets as a percentage for each time a bucket was hit.

Parameters
fmtOptionally, specifies the output format of the string (default = NONE).
nMaxDotsOptionally, specifies the maximum number of dots used when 'bFull' = true, ignored when 'bFull' = false (default = 30).
strFmtOptionally, specifies the format string for each range (default = '0.00000').
bIncludePercentsOptionally, specifies to include the percentages.
Returns
The distribution string is returned.

Definition at line 589 of file BucketCollection.cs.

◆ Translate()

double MyCaffe.basecode.BucketCollection.Translate ( double  fVal)

Finds the Bucket associated with the value and returns the Bucket's average value.

Parameters
fValSpecifies the value to find.
Returns
The Bucket average is returned.

Definition at line 355 of file BucketCollection.cs.

◆ UnBucketize()

bool MyCaffe.basecode.BucketCollection.UnBucketize ( string  strName,
List< double[]>  rgrgData,
Log  log,
CancelEvent  evtCancel 
)

The UnBucketize method converts all Data received into their respective Bucket average values.

Parameters
strNameSpecifies the name to use when writing status information.
rgrgDataSpecifies the data to unbucketize.
logSpecifies the output log.
evtCancelSpecifies the CancelEvent used to cancel the unbucketizing process.
Returns
On success, true is returned, otherwise false.

Definition at line 485 of file BucketCollection.cs.

Property Documentation

◆ Count

int MyCaffe.basecode.BucketCollection.Count
get

Returns the number of Buckets.

Definition at line 251 of file BucketCollection.cs.

◆ IsDataReal

bool MyCaffe.basecode.BucketCollection.IsDataReal
getset

Get/set whether or not the Buckets hold Real values.

Definition at line 242 of file BucketCollection.cs.

◆ this[int nIdx]

Bucket MyCaffe.basecode.BucketCollection.this[int nIdx]
get

Returns the bucket at a given index.

Parameters
nIdxSpecifies the index of the bucket to retrieve.
Returns
The bucket at the index is returned.

Definition at line 261 of file BucketCollection.cs.

◆ TotalCount

int MyCaffe.basecode.BucketCollection.TotalCount
get

Returns the total count across all buckets.

Definition at line 566 of file BucketCollection.cs.


The documentation for this class was generated from the following file: