#include <datacache.hh>
Public Member Functions | |
DataCache () | |
Default constructor, sets everything to zero. | |
~DataCache () | |
Deallocates pointer data. | |
bool | ReadFromDisk (string filename) |
Reads an etree data file from disk.. | |
const double * | GetRandomVector () |
Return a random vector from the data set. | |
void | Shuffle () |
Randomizes the order of the vectors. | |
void | StartNewRound () |
Reset the shuffler to its beginning state. | |
const double * | GetNextVector (bool &last) |
Returns the next vector in the cache. | |
const double * | GetVectorNumber (int number) const |
Get a vector with the given number. | |
int | GetDimension () const |
int | GetSize () const |
double * | GetMinMax () const |
Find the min and max values of every vector element. | |
string | GetLabel (int n) const |
Return a textual label of the given element. | |
Protected Member Functions | |
void | DeleteData () |
Totally obliterates all traces of the data space and shuffler. | |
void | CreateShuffler () |
Creates the shuffler data structure. | |
Protected Attributes | |
vector< double * > | data |
The data vectors. Remember that vector does not do autodisallocation. | |
int | dim |
Data vectors' dimension. | |
int * | shuffler |
Used by GetNextVector to pass through data randomly. | |
int | currentVector |
Which vector are we processing at the moment. | |
vector< string > | labels |
Class labels for the data vectors. |
This particular implementation reads SomPAK-type data files, and keeps them in memory. For more demanding applications (e.g. accessing data stored in SQL) use subclassing.
|
Creates the shuffler data structure. Note that this shuffler returns the data in the original order. To actually randomize the data, call Shuffle(). |
|
Return a textual label of the given element. The label is usually a class label, but can be anything.
|
|
Find the min and max values of every vector element. Returns an array of size dim*2. The first dim elements have the minimum values of each element and the second dim elements have the max values. It is the caller's responsibility to free[] the array. |
|
Reads an etree data file from disk.. A data vector's label will be the last element on its line.
|