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

Learner Class Reference

Abstract interface for any ANN implementations. More...

#include <learning.h>

Inheritance diagram for Learner:

ANNetwork List of all members.

Public Methods

 Learner ()
virtual void make (const char *description)=0
virtual void init (double r=-1)=0
virtual double train (const PatternSet &set, int cycles, int cycint=-1, int vsize=-1)
double train (const PatternSet &trainSet, const PatternSet &validationSet, int cycles, int cycint=-1)
virtual double trainOnce (const PatternSet &trainset)
virtual Vector testPattern (const PatternSource &set, int pattern) const
virtual double test (const PatternSource &set) const
virtual ClassifResultstestClassify (const PatternSource &set) const
virtual void copyFreeNet (const ANNetwork &fnet, bool onlyWeights=false)
virtual void copy (const Learner &fnet, bool onlyWeights=false)
virtual ANNetworktoANNetwork () const

Detailed Description

Abstract interface for any ANN implementations.

This abstraction is intended be generic enough to accomodate every kind of artificial neural networks. But, since there are currently just a very few such implementations, this class may not be very mature.

Slightly bloated.

Definition at line 81 of file learning.h.


Constructor & Destructor Documentation

Learner  
 

This file is part of the Inanna library.

* * Copyright (C) 1997-2002 Marko Grönroos <magi@iki.fi> * *

* This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; see the file COPYING.LIB. If * not, write to the Free Software Foundation, Inc., 59 Temple Place *

  • Suite 330, Boston, MA 02111-1307, USA. * *

Definition at line 41 of file learning.cc.


Member Function Documentation

void copy const Learner &    fnet,
bool    onlyWeights = false
[virtual]
 

Copy or conversion from any other neural network.

Parameters:
fnet  Learner to be copied. It is probable that the implementor wants to use dynamic_cast to find out the true class of the source class.
onlyWeights  If this flag is 'true', both networks are assumed to have the same topology. Therefore, only weights and activations have to be copied.

Definition at line 235 of file learning.cc.

Referenced by ANNetwork::copy(), and copyFreeNet().

void copyFreeNet const ANNetwork   fnet,
bool    onlyWeights = false
[virtual]
 

Copy or conversion from ANNetwork.

Implementing this is essential for the use of Terminator early stopping, because transient network states are stored in ANNetwork objects during training.

Parameters:
onlyWeights  If this flag is 'true', both networks are assumed to have the same topology. Therefore, only weights and activations have to be copied.

Reimplemented in ANNetwork.

Definition at line 219 of file learning.cc.

References copy().

void init double    r = -1 [pure virtual]
 

Initializes the network with the given weight range (use default if negative).

Implemented in ANNetwork.

void make const char *    description [pure virtual]
 

Creates a network according to the given structure description.

The exact interpretation of the description are dependent on the implementor.

Implemented in ANNetwork.

double test const PatternSource   set const [virtual]
 

Tests an entire pattern set.

Returns:
Returns MSE (mean squared error).

Definition at line 121 of file learning.cc.

References PatternSource::output(), PatternSource::outputs, PatternSource::patterns, and testPattern().

Referenced by Terminator::validate().

ClassifResults * testClassify const PatternSource   set const [virtual]
 

Makes a classification test with the given test set.

If there is just one output unit, it is interpreted to indicate two class memberships. In any other case, each output unit designates different class.

Returns:
Returns the classification results for each class in a ClassifResults struct.

Definition at line 146 of file learning.cc.

References ClassifResults::classcnts, ClassifResults::classSizes, ClassifResults::failures, PatternSource::getClass(), ClassifResults::mse, PatternSource::output(), PatternSource::outputs, PatternSource::patterns, and testPattern().

Vector testPattern const PatternSource   set,
int    pattern
const [virtual]
 

Tests a specific pattern from a set.

Returns a double vector containing the output values.

Returns:
Vector containing the values of output units.
Parameters:
set  The PatternSet where the pattern is stored.
pattern  Index number of the pattern in the PatternSet.

Reimplemented in ANNetwork.

Definition at line 110 of file learning.cc.

Referenced by test(), and testClassify().

ANNetwork * toANNetwork   const [virtual]
 

Conversion to ANNetwork, a highly object-oriented network representation.

Definition at line 243 of file learning.cc.

double train const PatternSet   trainSet,
const PatternSet   validationSet,
int    cycles,
int    cycint = -1
 

Trains the network.

Coating for the other train method above; accepts validation set as a parameter.

Parameters:
trainSet  Training set.
validationSet  Validation set.
cycles  Maximum number of training cycles. The training may be terminated before this by the Terminator method used.
cycint  Validation interval for Terminator (early stopping) method. Default value -1 disables validation and thus early stopping, and training is carried out for the maximum number of training cycles.

Definition at line 86 of file learning.cc.

double train const PatternSet   set,
int    cycles,
int    cycint = -1,
int    vsize = -1
[virtual]
 

Trains the network.

MUST BE OVERLOADED if the ANN system uses any training (not necessary if it doesn't).

Returns:
Final MSE (mean squared error) at the end of the training.
Parameters:
set  Training set.
cycles  Maximum number of training cycles. The training may be terminated before this by the Terminator method used.
cycint  Validation interval for Terminator (early stopping) method. Default value -1 disables validation and thus early stopping, and training is carried out for the maximum number of training cycles.
vsize  OPTIONAL Number of patterns in the 'set' used as a validation set.

Definition at line 64 of file learning.cc.

double trainOnce const PatternSet   trainset [virtual]
 

Trains the network for one cycle.

MUST BE OVERLOADED if training is desired.

Definition at line 99 of file learning.cc.


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