#include <node.hh>
Public Member Functions | |
Node () | |
Basic constructor. | |
Node (const Node &source) | |
Copy constructor. | |
~Node () | |
Destructor. | |
double | Distance (const double *sample) const |
Euclidean distance between prototype and sample. | |
double | Distance (const Node &other) const |
int | GetParent () const |
void | SetParent (const int newparent) |
const vector< int > & | GetChildren () const |
void | SetChildren (const vector< int > newchildren) |
void | AddChild (int newchild) |
void | ClearChildren () |
int | GetNumber () const |
void | SetNumber (int newnumber) |
int | GetDimension () |
const double * | GetDataVector () const |
Get the data vector. | |
void | SetDataVector (int ndim, const double *newvector) |
Assign a new data vector. | |
void | SetDataVector (const double *newvector) |
Assign a new data vector. | |
void | UpdateTowards (const double *targetvector, const double weight) |
Move towards the given vector. | |
double | IncrementBMU () |
Increment BMU count. | |
double | BestMatches () const |
void | ClearBestMatches () |
void | SetBestMatches (double bm) |
void | CopyDataFrom (const Node &source) |
Duplicate a state. | |
void | PrintInTextForm (ostream &os) |
Prints the data vector. | |
Node & | operator= (const Node &source) |
Assignment operator. | |
void | PrintState (ostream &os) const |
Print state info. | |
void | PrintProto (ostream &os) const |
A verbose description of the data vector. | |
Private Attributes | |
double * | proto |
The prototype vector. | |
int | dim |
Dimension of the prototype vector. | |
int | mynumber |
This node's number (or index) in the tree. | |
int | parent |
The parent's number in the tree. | |
vector< int > | children |
Children's numbers, if any. | |
double | bestmatches |
How many times this node has been the BMU. | |
Friends | |
ostream & | operator<< (ostream &os, Node &outnode) |
Serializes the node. | |
istream & | operator>> (istream &is, Node &innode) |
Creates a new node from binary stream. |
A simple node that forms a basis of the Evolving Tree. It only contains a prototype vector and knowledge of its parents and children.
|
Basic constructor. Sets everything to zero. |
|
Copy constructor.
|
|
Destructor. Very basic, just unallocates the data vector. |
|
Duplicate a state. Duplicate the state of some other node to this one. Also copies the count numbers, so be careful not to shoot yourself in the foot with those.
|
|
Euclidean distance between prototype and sample. Calculates the euclidian distance between the node and a given data vector.
|
|
Get the data vector. Returns a copy of the node's data vector.
|
|
Increment BMU count. Call this when the node has been selected as the BMU
|
|
Prints the data vector. Prints the elements of the location vector to the stream. The elements are separated by a space and the line is ended by a linefeed. This function can be used, for example, exporting the nodes as Matlab matrices.
|
|
A verbose description of the data vector. Prints a free form description of the data vector.
|
|
Print state info. Outputs the state of the node in plain text to the specified stream. Does not output prototype vector.
|
|
Assign a new data vector. Sets the node's data vector to a new one.
|
|
Assign a new data vector. Replaces the node's data vector with a new one with the given dimension.
|
|
Move towards the given vector. Updates the node towards the given data vector by the amount specified by weight. Currently implemented with the Kohonen rule.
|
|
Serializes the node. Writes the node to the given stream as a binary dump. The dump does not have any magic numbers or other identifiers.
|
|
Creates a new node from binary stream. Reads the binary stream and uses it to build a new node. No error checking of any kind is done, so make sure that the stream points to a sensible location.
|