Main Page | Class List | File List | Class Members | File Members

DataCache Class Reference

A contained and accessor for data vectors used by the Evolving Tree. More...

#include <datacache.hh>

List of all members.

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.


Detailed Description

A contained and accessor for data vectors used by the Evolving Tree.

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.


Member Function Documentation

void DataCache::CreateShuffler  )  [protected]
 

Creates the shuffler data structure.

Note that this shuffler returns the data in the original order. To actually randomize the data, call Shuffle().

string DataCache::GetLabel int  n  )  const
 

Return a textual label of the given element.

The label is usually a class label, but can be anything.

Parameters:
n Index to the desired vector.
Returns:
The class label or "INDEXOUTOFBOUNDS", if, surprisingly, the index is out of bounds.

double * DataCache::GetMinMax  )  const
 

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.

bool DataCache::ReadFromDisk string  filename  ) 
 

Reads an etree data file from disk..

A data vector's label will be the last element on its line.

Returns:
true on success.


The documentation for this class was generated from the following files:
Generated on Wed May 17 15:43:41 2006 for The Evolving Tree by  doxygen 1.4.1