Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

PatternSet Class Reference

Typical, tabular pattern set. More...

#include <patternset.h>

Inheritance diagram for PatternSet:

PatternSource List of all members.

Public Methods

 PatternSet (int patts, int ins, int outs)
 PatternSet (const String &fname, int ins=0, int outs=0)
 PatternSet (const Matrix &m, int ins=-1, int outs=0)
 PatternSet (const PatternSet &orig)
void make (int patts=0, int ins=0, int outs=0)
virtual void load (const char *filename)
virtual void load (TextIStream &in, const String &extension=".raw")
void save (const String &filename, int filetype=FT_SNNS)
virtual void print (FILE *out=stdout) const
virtual double input (int p, int i) const
virtual double output (int p, int j) const
virtual void set_input (int p, int i, double value)
virtual void set_output (int p, int j, double value)
Ref< Matrix > getMatrix () const
void mutate (int errcnt)
void recombine (int startp=-1, int endp=-1)
void recombine2 (int startp=-1, int endp=-1)
virtual void copy (const PatternSet &orig, int start=-1, int end=-1)
void check () const

Protected Methods

void calc_means ()
void calc_stddevs ()

Protected Attributes

Matrix mInps
Matrix mOutps

Detailed Description

Typical, tabular pattern set.

Definition at line 181 of file patternset.h.


Constructor & Destructor Documentation

PatternSet int    patts,
int    ins,
int    outs
 

Constructs an empty pattern set of the given dimensions.

Definition at line 231 of file patternset.cc.

References PatternSource::inputs, make(), PatternSource::outputs, and PatternSource::patterns.

PatternSet const String &    filename,
int    ins = 0,
int    outs = 0
 

Constructs and loads a pattern set from a file.

The file must be in SNNS pattern file format. If the dimensions of the training set have not been set, load tries to deduce them from the file. If the dimensions of the file differ from the values that may have been given in the construction, an exception is thrown.

Parameters:
filename  Name of the pattern file.
ins  Number of input variables.
outs  Number of output variables.

Definition at line 248 of file patternset.cc.

References PatternSource::inputs, load(), PatternSource::outputs, and PatternSource::patterns.

PatternSet const Matrix &    m,
int    ins = -1,
int    outs = 0
 

Copy constructor.

Definition at line 259 of file patternset.cc.

References make(), set_input(), and set_output().

PatternSet const PatternSet &    orig
 

Copy constructor.

Definition at line 273 of file patternset.cc.

References check().


Member Function Documentation

void calc_means   [protected]
 

Calculates the averages of each input and output field.

void calc_stddevs   [protected]
 

Calculates the standard deviations of each input and output field.

void check  
 

Checks internal consistency of the object.

Reimplemented from PatternSource.

Definition at line 404 of file patternset.cc.

References PatternSource::check().

Referenced by PatternSet().

void copy const PatternSet &    orig,
int    start = -1,
int    end = -1
[virtual]
 

Implementation for PatternSource.

Copies a range from another training set.

Parameters:
startp  OPTIONAL Lower index of copying range.
endp  OPTIONAL Upper index of copying range.

Definition at line 409 of file patternset.cc.

References PatternSource::copy().

Ref< Matrix > getMatrix  
 

Returns all the patterns (both input and output variables) as a Matrix.

Definition at line 413 of file patternset.cc.

References input(), PatternSource::inputs, output(), PatternSource::outputs, and PatternSource::patterns.

virtual double input int    p,
int    i
const [inline, virtual]
 

Returns the input value of the given pattern.

Reimplemented from PatternSource.

Definition at line 220 of file patternset.h.

References mInps.

Referenced by getMatrix(), and BackpropTrainer::trainPattern().

void load TextIStream &    in,
const String &    extension = ".raw"
[virtual]
 

Loads a pattern set from a pattern input stream.

Parameters:
extension  File name extension; ".raw",".pat" (SNNS), or ".dt" (Proben1)

Definition at line 298 of file patternset.cc.

References DataFormatLib::load().

void load const char *    filename [virtual]
 

Loads a pattern set from a pattern file.

Supports SNNS file format (.pat), Proben1 (.dt), and matrix file format (other suffixes). Overloadable to allow implementations of other formats.

Definition at line 289 of file patternset.cc.

References DataFormatLib::load().

Referenced by PatternSet().

void make int    patts = 0,
int    ins = 0,
int    outs = 0
[virtual]
 

Constructs an empty pattern set with the given dimensions.

Parameters:
patts  Number of patterns in the set
ins  Number of input variables
outs  Number of output variables

Reimplemented from PatternSource.

Definition at line 277 of file patternset.cc.

References mInps, and mOutps.

Referenced by SNNSDataFormat::load(), and PatternSet().

void mutate int    errcnt
 

Mutates the inputs of the training set by given number of errors.

The number of errors equals to the hamming distance between normal and mutated patterns.

Definition at line 330 of file patternset.cc.

References mInps.

virtual double output int    p,
int    j
const [inline, virtual]
 

Returns the output value of the given pattern.

Reimplemented from PatternSource.

Definition at line 223 of file patternset.h.

References mOutps.

Referenced by getMatrix(), and BackpropTrainer::trainPattern().

void print FILE *    out = stdout const [virtual]
 

Outputs the patternset to a C-style FILE stream.

Reimplemented from PatternSource.

Definition at line 313 of file patternset.cc.

References mInps, and mOutps.

void recombine int    startp = -1,
int    endp = -1
[virtual]
 

Permutates a set of patterns to a random configuration.

If range is specified, only those patterns are reshuffled.

Reimplemented from PatternSource.

Definition at line 350 of file patternset.cc.

References PatternSource::inputs, mInps, mOutps, PatternSource::outputs, and PatternSource::patterns.

void recombine2 int    startp = -1,
int    endp = -1
[virtual]
 

As above, except ...

Reimplemented from PatternSource.

Definition at line 375 of file patternset.cc.

References PatternSource::inputs, mInps, mOutps, PatternSource::outputs, and PatternSource::patterns.

void save const String &    filename,
int    filetype = FT_SNNS
 

Saves the pattern set.

The pattern set is saved with the given output format.

Parameters:
filename  Name of the pattern file.
filetype  One of FT_SNNS (SNNS format, default), FT_RAW (raw format).

Definition at line 307 of file patternset.cc.

References DataFormatLib::save().

virtual void set_input int    p,
int    i,
double    value
[inline, virtual]
 

Sets the input value of the given pattern.

Reimplemented from PatternSource.

Definition at line 226 of file patternset.h.

References mInps.

Referenced by SNNSDataFormat::load(), AbsoluteNeuralPrediction::makeSet(), and PatternSet().

virtual void set_output int    p,
int    j,
double    value
[inline, virtual]
 

Sets the input value of the given pattern.

Reimplemented from PatternSource.

Definition at line 229 of file patternset.h.

References mOutps.

Referenced by SNNSDataFormat::load(), AbsoluteNeuralPrediction::makeSet(), and PatternSet().


Member Data Documentation

Matrix mInps [protected]
 

Input patterns.

Definition at line 261 of file patternset.h.

Referenced by input(), make(), mutate(), print(), recombine(), recombine2(), and set_input().

Matrix mOutps [protected]
 

Output patterns.

Definition at line 264 of file patternset.h.

Referenced by make(), output(), print(), recombine(), recombine2(), and set_output().


The documentation for this class was generated from the following files:
Generated on Thu Feb 10 20:06:45 2005 for Inanna by doxygen1.2.18