MatrixLinker Class define a full connection between two cluster. More...

Public Member Functions | |
MatrixLinker (Cluster *from, Cluster *to, QString name="unnamed") | |
Connect clusters with a complete connections By default it create a fully-connected matrix, use one of the following methods for choose a different way: connect, connectRandom, disconnect, disconnectRandom. | |
MatrixLinker (ConfigurationParameters ¶ms, QString prefix) | |
Constructor. | |
virtual | ~MatrixLinker () |
Destructor. | |
unsigned int | cols () |
Get the number of cols. | |
void | connect (unsigned int from, unsigned int to) |
Connect two neurons. | |
void | connectAll () |
Connect all couples of neurons. | |
void | connectRandom (double prob, bool zeroDiagonal=false, bool symmetric=false) |
Connect neurons of Clusters with a random connections with the passed probability. | |
void | disconnect (unsigned int from, unsigned int to) |
Disconnect the two neurons. | |
void | disconnectAll () |
Disonnect all couples of neurons. | |
DoubleMatrix & | matrix () |
Return the weight matrix. | |
DoubleMatrix | matrix () const |
const version of matrix() method | |
virtual void | randomize (double min, double max) |
Randomize the weights of the MatrixLinker. | |
unsigned int | rows () |
Get the number of rows. | |
virtual void | save (ConfigurationParameters ¶ms, QString prefix) |
Save the actual status of parameters into the ConfigurationParameters object passed. | |
virtual void | setWeight (unsigned int from, unsigned int to, double weight) |
Set the weight of the connection specified. | |
unsigned int | size () const |
Returns the total number of the links: rows*cols. | |
virtual double | weight (unsigned int from, unsigned int to) |
Get the weight of the connection specified. | |
![]() | |
Linker (Cluster *from, Cluster *to, QString name="unnamed") | |
Construct. | |
Linker (ConfigurationParameters ¶ms, QString prefix) | |
Constructor. | |
void | configureFromVector (QString vectorName) |
Configure on which state vector of 'from' Cluster this Linker is attached to. | |
void | configureToVector (QString vectorName) |
Configure on which state vector of 'to' Cluster this Linker is attached to. | |
Cluster * | from () const |
Return the Cluster From. | |
Cluster * | to () const |
Return the Cluster to. | |
![]() | |
Updatable (QString name="unnamed") | |
Constructor. | |
Updatable (ConfigurationParameters ¶ms, QString prefix) | |
Constructor. | |
virtual | ~Updatable () |
Destructor. | |
QString | name () const |
Return its name. | |
void | setName (QString newname) |
Set the name of Updatable. | |
virtual void | update ()=0 |
Update the object. | |
![]() | |
ParameterSettableInConstructor (ConfigurationParameters &, QString) | |
void | addObserver (RuntimeParameterObserver *obs) |
T | getRuntimeParameter (QString paramName) |
virtual ParameterSettableUI * | getUIManager () |
ParameterSettable () | |
virtual void | postConfigureInitialization () |
void | removeObserver (RuntimeParameterObserver *obs) |
void | setRuntimeParameter (QString paramName, T newvalue) |
QString | typeName () const |
![]() | |
void | addObserver (RuntimeParameterObserver *obs) |
T | getRuntimeParameter (QString paramName) |
void | removeObserver (RuntimeParameterObserver *obs) |
void | setRuntimeParameter (QString paramName, T newvalue) |
QString | typeName () const |
Additional Inherited Members | |
![]() | |
enum | Property |
![]() | |
static void | describe (QString type) |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups. | |
![]() | |
AllowMultiple | |
Default | |
IsList | |
IsMandatory | |
![]() | |
static const double | Infinity |
static const int | MaxInteger |
static const int | MinInteger |
![]() | |
DoubleVector & | fromVector () const |
Return a reference to the DoubleVector of 'from' on which this is attached to. | |
DoubleVector & | toVector () const |
Return a reference to the DoubleVector of 'to' on which this is attached to. | |
![]() | |
static Descriptor | addTypeDescription (QString type, QString shortHelp, QString longHelp=QString("")) |
static void | setGraphicalEditor (QString type) |
Detailed Description
MatrixLinker Class define a full connection between two cluster.
- Motivation
- This class rapresent connections between neuron's 'from' Cluster and neuron's 'to' Cluster with a matrix. It allow sparse connections as full connections amogns neurons. The connections has a weight and are stored in a matrix which the rows are the neuron's 'from' and the columns the neuron's 'to'.
- Description
- Every connection is weighted, and the weight is memorized into a weight-matrix.
The effective computation of inputs' 'to' is done in the subclasses (DotLinker, NormLinker, etc). The disconnection / connection of neurons are implemented fixating/unfixating the weight to zero into the underlying matrix using DoubleMatrix::steady and DoubleMatrix::unsteady methods
- Warning
Definition at line 47 of file matrixlinker.h.
Constructor & Destructor Documentation
MatrixLinker | ( | Cluster * | from, |
Cluster * | to, | ||
QString | name = "unnamed" |
||
) |
Connect clusters with a complete connections By default it create a fully-connected matrix, use one of the following methods for choose a different way: connect, connectRandom, disconnect, disconnectRandom.
Definition at line 25 of file matrixlinker.cpp.
References DoubleMatrix::zeroing().
MatrixLinker | ( | ConfigurationParameters & | params, |
QString | prefix | ||
) |
Constructor.
Definition at line 30 of file matrixlinker.cpp.
References ConfigurationParameters::getValue().
|
virtual |
Destructor.
Definition at line 56 of file matrixlinker.cpp.
Member Function Documentation
|
inline |
Get the number of cols.
Definition at line 63 of file matrixlinker.h.
Referenced by MatrixLinker::connectAll(), MatrixLinker::connectRandom(), MatrixLinker::disconnectAll(), MatrixLinker::save(), and NormLinker::update().
void connect | ( | unsigned int | from, |
unsigned int | to | ||
) |
Connect two neurons.
Definition at line 79 of file matrixlinker.cpp.
References DoubleMatrix::unsteady().
void connectAll | ( | ) |
Connect all couples of neurons.
Definition at line 130 of file matrixlinker.cpp.
References MatrixLinker::cols(), MatrixLinker::rows(), and DoubleMatrix::unsteady().
void connectRandom | ( | double | prob, |
bool | zeroDiagonal = false , |
||
bool | symmetric = false |
||
) |
Connect neurons of Clusters with a random connections with the passed probability.
And disconnect neurons with probability (1.0-prob).
- Parameters
-
prob is the probability to have a connection between two neurons zeroDiagonal if it is true the matrix diagonal is always disconnected symmetric if it is true the connections are symmetric
- Warning
- The parameter symmetric requires a square matrix (i.e. the Cluster from and to must be of the same size
Definition at line 83 of file matrixlinker.cpp.
References MatrixLinker::cols(), globalRNG, MatrixLinker::rows(), DoubleMatrix::steady(), and DoubleMatrix::unsteady().
void disconnect | ( | unsigned int | from, |
unsigned int | to | ||
) |
Disconnect the two neurons.
Definition at line 138 of file matrixlinker.cpp.
References Linker::from(), DoubleMatrix::steady(), Linker::to(), and DoubleMatrix::unsteady().
void disconnectAll | ( | ) |
Disonnect all couples of neurons.
Definition at line 144 of file matrixlinker.cpp.
References MatrixLinker::cols(), MatrixLinker::rows(), DoubleMatrix::steady(), and DoubleMatrix::unsteady().
|
inline |
Return the weight matrix.
Definition at line 75 of file matrixlinker.h.
Referenced by DotLinker::update(), and NormLinker::update().
|
inline |
const version of matrix() method
Definition at line 79 of file matrixlinker.h.
|
virtual |
Randomize the weights of the MatrixLinker.
Implements Linker.
Definition at line 63 of file matrixlinker.cpp.
References globalRNG.
|
inline |
Get the number of rows.
Definition at line 59 of file matrixlinker.h.
Referenced by MatrixLinker::connectAll(), MatrixLinker::connectRandom(), MatrixLinker::disconnectAll(), and MatrixLinker::save().
|
virtual |
Save the actual status of parameters into the ConfigurationParameters object passed.
This saves the name property, remember to call this in child classes
- Parameters
-
params the configuration parameters object on which save actual parameters prefix the prefix to use to access the object configuration parameters.
Reimplemented from Linker.
Reimplemented in DotLinker, and NormLinker.
Definition at line 154 of file matrixlinker.cpp.
References MatrixLinker::cols(), ConfigurationParameters::createParameter(), MatrixLinker::rows(), Linker::save(), and ConfigurationParameters::startObjectParameters().
Referenced by NormLinker::save(), and DotLinker::save().
|
virtual |
Set the weight of the connection specified.
Definition at line 71 of file matrixlinker.cpp.
References Linker::from(), Linker::to(), and MatrixLinker::weight().
|
virtual |
Returns the total number of the links: rows*cols.
Implements Linker.
Definition at line 59 of file matrixlinker.cpp.
|
virtual |
Get the weight of the connection specified.
Definition at line 75 of file matrixlinker.cpp.
References Linker::from(), and Linker::to().
Referenced by MatrixLinker::setWeight().
The documentation for this class was generated from the following files:
- nnfw/include/matrixlinker.h
- nnfw/src/matrixlinker.cpp