Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

annie::TrainingSet Class Reference

#include <TrainingSet.h>

List of all members.

Public Methods

 TrainingSet (int in, int out)
 TrainingSet (const char *filename, int file_type=TEXT_FILE)
virtual ~TrainingSet ()
void addIOpair (real *input, real *output)
 Add an input and correspoding output vector. More...

void addIOpair (VECTOR input, VECTOR output)
virtual void initialize ()
virtual bool epochOver ()
virtual int getSize ()
 The number of input/desired-output vector pairs in the training set. More...

virtual int getInputSize ()
 The size of an input vector. More...

virtual int getOutputSize ()
 The size of an output vector. More...

virtual void getNextPair (VECTOR &input, VECTOR &desired)
virtual void save (const char *filename, int file_type=TEXT_FILE)
virtual const char * getClassName ()
 Returns "TrainingSet". More...


Protected Methods

void save_binary (const char *filename)
 Save the training set in binary format to the given filename. More...

void save_text (const char *filename)
 Save the file in text format to the given filename. More...

void load_binary (const char *filename)
 Load from a binary file. More...

void load_text (const char *filename)
 Load from a text file. More...


Protected Attributes

std::vector< VECTOR_inputs
 The set of input vectors. More...

std::vector< VECTOR_outputs
 The set of corresponding desired output vectors. More...

std::vector< VECTOR >::iterator _inputIter
 An iterator through the input vectors. More...

std::vector< VECTOR >::iterator _outputIter
 Iterator through the output vectors. More...

int _nInputs
 Size of an input vector. More...

int _nOutputs
 Size of an output vector. More...


Friends

std::ostream & operator<< (std::ostream &s, TrainingSet &T)
 Allows you to print the TrainingSet onto a stream. More...


Detailed Description

This is an abstraction for the set of patterns which are used to "train" a network. It will contain sets of input and corresponding desired-output vectors which will be used by the training algorithms of supervised networks, such as the MultiLayerNetwork and RadialBasisNetwork

You can save TrainingSets into a file. The file can be text, a simple format so that you can construct the file from other programs as well, or the file can be a binary file which is understood only by this library. Binary files are generally smaller and quicker to load.

You can use utilities provided with the library distribution to convert from one format to the other.


Constructor & Destructor Documentation

annie::TrainingSet::TrainingSet int    in,
int    out
 

Create an empty training set

Parameters:
in  The size of an input vector
out  The size of an output vector

annie::TrainingSet::TrainingSet const char *    filename,
int    file_type = TEXT_FILE
 

Create a tranining set from a file.

Parameters:
filename  The name of the file
file_type  The type of the file (annie::BINARY_FILE) or (annie::TEXT_FILE). TEXT_FILE by default

virtual annie::TrainingSet::~TrainingSet   [virtual]
 


Member Function Documentation

void annie::TrainingSet::addIOpair VECTOR    input,
VECTOR    output
 

Add an input and corresponding output vector

Exceptions:
Exception  If the input vector size is not the same as getInputSize() or the output vector size is not the same as getOutputSize()

void annie::TrainingSet::addIOpair real   input,
real   output
 

Add an input and correspoding output vector.

virtual bool annie::TrainingSet::epochOver   [virtual]
 

Has a cycle through all input/output pairs been completed?

Returns:
true if all input/output pairs have been seen through getNextPair
See also:
getNextPair , initialize

virtual const char* annie::TrainingSet::getClassName   [virtual]
 

Returns "TrainingSet".

virtual int annie::TrainingSet::getInputSize   [virtual]
 

The size of an input vector.

virtual void annie::TrainingSet::getNextPair VECTOR   input,
VECTOR   desired
[virtual]
 

Returns the next input/output vector pair. You would typically use this in a fashion somewhat like:

 TrainingSet T("trset_file");
 T.initialize();
 VECTOR in,out;
 while (!T.epochOver())
 {
                T.getNextPair(in,out);
                // do what you need to with in and out
 }
Parameters:
input  The input vector is returned here
desired  The corresponding desired output vector is returned here

virtual int annie::TrainingSet::getOutputSize   [virtual]
 

The size of an output vector.

virtual int annie::TrainingSet::getSize   [virtual]
 

The number of input/desired-output vector pairs in the training set.

virtual void annie::TrainingSet::initialize   [virtual]
 

Initialize the training set so that the first call to getNextPair() gives the first I/O pair stored.

See also:
getNextPair

void annie::TrainingSet::load_binary const char *    filename [protected]
 

Load from a binary file.

void annie::TrainingSet::load_text const char *    filename [protected]
 

Load from a text file.

virtual void annie::TrainingSet::save const char *    filename,
int    file_type = TEXT_FILE
[virtual]
 

Saves the training set to a file.

Parameters:
filename  The name of the file to save the training set to
file_type  The type of file to generate (annie::BINARY_FILE) or (annie::TEXT_FILE). Default is TEXT_FILE

void annie::TrainingSet::save_binary const char *    filename [protected]
 

Save the training set in binary format to the given filename.

void annie::TrainingSet::save_text const char *    filename [protected]
 

Save the file in text format to the given filename.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &    s,
TrainingSet &    T
[friend]
 

Allows you to print the TrainingSet onto a stream.


Member Data Documentation

std::vector< VECTOR >::iterator annie::TrainingSet::_inputIter [protected]
 

An iterator through the input vectors.

std::vector< VECTOR > annie::TrainingSet::_inputs [protected]
 

The set of input vectors.

int annie::TrainingSet::_nInputs [protected]
 

Size of an input vector.

int annie::TrainingSet::_nOutputs [protected]
 

Size of an output vector.

std::vector< VECTOR >::iterator annie::TrainingSet::_outputIter [protected]
 

Iterator through the output vectors.

std::vector< VECTOR > annie::TrainingSet::_outputs [protected]
 

The set of corresponding desired output vectors.


The documentation for this class was generated from the following file:
Generated on Wed Apr 23 10:42:36 2003 for BioFilter by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002