Robot Simulator of the Robotics Group for Self-Organization of Control: SOM Class Reference

# SOM Class Reference

self-organised map class. More...

`#include <som.h>`

Inherits AbstractModel.

Collaboration diagram for SOM:
[legend]

List of all members.

## Public Types
typedef std::list< std::pair < int, double > > | Neighbours
typedef std::vector< std::pair < matrix::Matrix, double > > | Neighbourhood
## Public Member Functions
| SOM (const std::string &name="SOM", const std::string &revision="$Id$")
| SOM (unsigned int dimensions, double sigma, double eps, double rbfsize, const std::string &name="SOM", const std::string &revision="$Id$")
| create a som
virtual | ~SOM ()
virtual void | init (unsigned int inputDim, unsigned int outputDim, double unit_map=0.0, RandGen *randGen=0)
| initialised som
virtual const matrix::Matrix | process (const matrix::Matrix &input)
| passive processing of the input (this function is not constant since a recurrent network for example might change internal states
virtual const matrix::Matrix | learn (const matrix::Matrix &input, const matrix::Matrix &nom_output, double learnRateFactor=1)
virtual void | damp (double damping)
| damps the weights and the biases by multiplying (1-damping)
virtual unsigned int | getInputDim () const
| returns the number of input neurons
virtual unsigned int | getOutputDim () const
| returns the number of output neurons
virtual bool | store (FILE *f) const
| stores the object to the given file stream (binary).
virtual bool | restore (FILE *f)
| loads the object from the given file stream (binary).
virtual void | printWeights (FILE *f) const
const Neighbourhood & | getNeighbourhood ()
## Public Attributes
double | eps
| learning rate for weight update
## Protected Member Functions
void | initNeighbourhood (double sigma)
| initialised neighbourhood
Neighbours | getNeighbours (int winner)
| returns neighbourhood as a list of indices with weights
## Static Protected Member Functions
static double | activationfunction (void *rdfsize, double d)
| activation function (rbf)
static bool | validCoord (const matrix::Matrix &m, int size)
| checks whether the given coordinate is within the lattice
static int | coordToIndex (const matrix::Matrix &m, int size)
| converts index to coordinates (size is the size of the space)
static matrix::Matrix | indexToCoord (int index, int size, int dimensions)
| converts coordinates to index (size is the size of the space)

## Detailed Description

self-organised map class.

Implementation follows normal vector-quantiser scheme. The output of the network is for each neuron.

## Member Typedef Documentation

typedef std::vector<std::pair<matrix::Matrix,double> > Neighbourhood

typedef std::list< std::pair<int,double> > Neighbours

## Constructor & Destructor Documentation

SOM | ( | const std::string & | name = `"SOM"`,
|  | const std::string & | revision = `"$Id$"` |
| ) |  |  |

SOM | ( | unsigned int | dimensions,
|  | double | sigma,
|  | double | eps,
|  | double | rbfsize,
|  | const std::string & | name = `"SOM"`,
|  | const std::string & | revision = `"$Id$"` |
| ) |  |  |

create a som

Parameters:

  | dimensions | number of dimensions of the neuron lattice

virtual ~SOM | ( |  | ) | `[inline, virtual]`

## Member Function Documentation

double activationfunction | ( | void * | rdfsize,
|  | double | d |
| ) |  |  | `[static, protected]`

activation function (rbf)

int coordToIndex | ( | const matrix::Matrix & | m,
|  | int | size |
| ) |  |  | `[static, protected]`

converts index to coordinates (size is the size of the space)

virtual void damp | ( | double | damping | ) | `[inline, virtual]`

damps the weights and the biases by multiplying (1-damping)

Implements AbstractModel.

virtual unsigned int getInputDim | ( |  | ) | const`[inline, virtual]`

returns the number of input neurons

Implements AbstractModel.

const Neighbourhood& getNeighbourhood | ( |  | ) | `[inline]`

SOM::Neighbours getNeighbours | ( | int | winner | ) | `[protected]`

returns neighbourhood as a list of indices with weights

virtual unsigned int getOutputDim | ( |  | ) | const`[inline, virtual]`

returns the number of output neurons

Implements AbstractModel.

Matrix indexToCoord | ( | int | index,
|  | int | size,
|  | int | dimensions |
| ) |  |  | `[static, protected]`

converts coordinates to index (size is the size of the space)

void init | ( | unsigned int | inputDim,
|  | unsigned int | outputDim,
|  | double | unit_map = `0.0`,
|  | RandGen * | randGen = `0` |
| ) |  |  | `[virtual]`

initialised som

Parameters:

  | inputDim | dimension of input vector
  | outputDim | number of outputneurons (must be a multiple of "dimensions" given at constructor)
  | unit_map | if zero then weights are randomly choosed, otherwise uniformly distributed in the inputspace of size (unit_map x unit_map x ...)

initialise neighbourhood

Implements AbstractModel.

void initNeighbourhood | ( | double | sigma | ) | `[protected]`

initialised neighbourhood

normalised gaussian

const Matrix learn | ( | const matrix::Matrix & | input,
|  | const matrix::Matrix & | nom_output,
|  | double | learnRateFactor = `1` |
| ) |  |  | `[virtual]`

Implements AbstractModel.

void printWeights | ( | FILE * | f | ) | const`[virtual]`

const Matrix process | ( | const matrix::Matrix & | input | ) | `[virtual]`

passive processing of the input (this function is not constant since a recurrent network for example might change internal states

Implements AbstractModel.

bool restore | ( | FILE * | f | ) | `[virtual]`

loads the object from the given file stream (binary).

Implements Storeable.

bool store | ( | FILE * | f | ) | const`[virtual]`

stores the object to the given file stream (binary).

Implements Storeable.

bool validCoord | ( | const matrix::Matrix & | m,
|  | int | size |
| ) |  |  | `[static, protected]`

checks whether the given coordinate is within the lattice

## Member Data Documentation

double eps

learning rate for weight update

The documentation for this class was generated from the following files:

- som.h
- som.cpp