Machine Learning Library
Public Member Functions | Public Attributes | Friends | List of all members
CSOM< Type > Class Template Reference

SOM class for Self Organizing Maps with arbitrary topology. More...

#include <MysqlDatabase.h>

Inheritance diagram for CSOM< Type >:
CClusterAlgorithm< Type > CObject< Type >

Public Member Functions

 CSOM (CMetric< double > *ptTheGridMetric=new CEuclideanMetric< double >())
 
 CSOM (const CSOM< Type > &SOM)
 Copy constructor. More...
 
 ~CSOM ()
 Descructor. More...
 
void setGridMetric (CMetric< double > *ptMetric)
 
void setDataMetric (CMetric< Type > *ptMetric)
 
CMetric< Type > * getDataMetricPtr ()
 
void setAlphaRate (CLearnRate< Type > *ptRate)
 
void setSigmaRate (CLearnRate< Type > *ptRate)
 
void setKernel (CKernel< Type > *ptTheKernel)
 
CSomTopology< Type > * topologyPtr ()
 
CDataset< Type > & metaData ()
 Returns the meta data dataset containing some statistics like node sizes. More...
 
void setMetaData (int iPos, Type *ptTheData)
 
float getMeta4Node (int iNode, int iPos)
 
void setUpdateSteps (int iVal)
 
CLearnRate< Type > & getAlphaRate ()
 
CLearnRate< Type > & getSigmaRate ()
 
CKernel< Type > & getKernel ()
 
void setLabel (int iNode, string strLabel)
 
string getLabel (int iNode)
 
void applyDataset (CDataset< Type > &rtDataset, int iMode=COPY_CLASSCOUNT)
 
void setUnit (int iNode, CDenseVector< Type > &rtVec)
 
int setCartesianTopology (vector< int > &rviNbUnits)
 
int setHyperbolicTopology (int iNeighbours, int iRings, int iVisible=3)
 
void setUnitsFromDataset (CDataset< Type > &rtData)
 
void setUnitsFromDatasetRandom (CDataset< Type > &rtData)
 
void setUnitsAlongVectors (vector< CDenseVector< Type > > cVectors, vector< Type > cMin, vector< Type > cMax)
 
void train (CDataset< Type > &rtTrainSet)
 
void trainTopology (CDataset< Type > &rtTrainSet)
 
void trainGrowing (CDataset< Type > &rtTrainSet, float fGrowParam)
 
CDataset< double > & nodeData ()
 
Type minimal_wiring (CMetric< Type > &cMetric)
 
void dump (void)
 Dumps the entire SOM to cout. More...
 
void uMat (vector< Type > &rvtDist, Type fNeighborhood)
 
int getNumNodes ()
 
int getNumVisibleNodes ()
 
int getVisibleNode (int iPos)
 
void copyNodeAttributes (int iContext, int iAttrib, float *pfTarget, float &fMin, float &fMax, float *pfSource=NULL)
 
void copyNodeDistances (float *pfDist)
 
bool selectNode (int iNode, bool bSelect)
 
int getNumSelectedNodes ()
 
int getSelectedNodes (bool bFirst)
 
int getBestMatchID ()
 
Type getNodeDistance (int iN1, int iN2)
 
void setFlowSize (int iNumItems)
 
int getFlowSize ()
 
void setFlowItem (int iPos, int *piNodes, char *pcDate, unsigned long iTime)
 
void computeFlow (float *pfParams)
 
void getFlow (int iPos, float *pfTarget, char *pcDate)
 
int getChildren (int iNode, int *piChildren)
 
float getProgress ()
 
- Public Member Functions inherited from CClusterAlgorithm< Type >
 CClusterAlgorithm (CMetric< Type > *ptMetric=new CEuclideanMetric< Type >())
 
virtual ~CClusterAlgorithm ()
 
void setMetric (CMetric< Type > *ptMetric)
 
CDataset< Type > getReferenceVectors () const
 
CDataset< Type > & referenceVectors ()
 
Type rmse (const CDataset< Type > &tDataset) const
 
int nearestNode (const CVector< Type > &rtPattern) const
 
Type nearestNodeDistance (const CVector< Type > &rtPattern) const
 
bool serialize (fstream &stream, IO_MODE mode)
 
- Public Member Functions inherited from CObject< Type >
 CObject ()
 Constructor. More...
 
virtual ~CObject ()
 Destructor. More...
 
virtual bool serialize2 (CArchiv &tArchiv)
 
virtual string className () const
 Returns the class name. More...
 
void setVerbose (VERBOSE_LEVEL tVerbose)
 Set the verbose level. More...
 
VERBOSE_LEVEL verbose (void) const
 Return current verbose level. More...
 
virtual bool isA (const char *acClass) const
 Check if the object is an instance of the class with given name. More...
 
DATATYPE dataType () const
 Returns the template data type. More...
 

Public Attributes

vector< string > vTopicNames
 Meta data: topic names. More...
 

Friends

class CHyperbolicTopology< Type >
 

Additional Inherited Members

- Protected Attributes inherited from CClusterAlgorithm< Type >
CDataset< Type > tReferenceVectors
 
CMetric< Type > * ptMetric
 
- Protected Attributes inherited from CObject< Type >
unsigned char ucVerbose
 

Detailed Description

template<class Type>
class CSOM< Type >

SOM class for Self Organizing Maps with arbitrary topology.

Constructor & Destructor Documentation

template<class Type>
CSOM< Type >::CSOM ( CMetric< double > *  ptTheGridMetric = new CEuclideanMetric< double >())

Constrcutor creates a new SOM instance

Parameters
ptTheGridMetricThe metric to use for distance computation of nodes on the grid.
template<class Type>
CSOM< Type >::CSOM ( const CSOM< Type > &  SOM)

Copy constructor.

template<class Type>
CSOM< Type >::~CSOM ( )

Descructor.

Member Function Documentation

template<class Type>
void CSOM< Type >::applyDataset ( CDataset< Type > &  rtDataset,
int  iMode = COPY_CLASSCOUNT 
)

Throws an entire dataset onto the SOM. Copy class count statistics or reference vectors to meta statistics or append list of BMUs for each input vector of the dataset to the output vector depending on the value of iMode.

Parameters
iModeSwitch between different modes: COPY_CLASSCOUNT (1), COPY_PROTOTYPE (2), APPEND_BMUS (4)
template<class Type>
void CSOM< Type >::computeFlow ( float *  pfParams)
template<class Type>
void CSOM< Type >::copyNodeAttributes ( int  iContext,
int  iAttrib,
float *  pfTarget,
float &  fMin,
float &  fMax,
float *  pfSource = NULL 
)
template<class Type>
void CSOM< Type >::copyNodeDistances ( float *  pfDist)
template<class Type>
void CSOM< Type >::dump ( void  )

Dumps the entire SOM to cout.

template<class Type>
CLearnRate<Type>& CSOM< Type >::getAlphaRate ( )
inline
template<class Type>
int CSOM< Type >::getBestMatchID ( )
inline
template<class Type>
int CSOM< Type >::getChildren ( int  iNode,
int *  piChildren 
)
template<class Type>
CMetric<Type>* CSOM< Type >::getDataMetricPtr ( )
inline
template<class Type>
void CSOM< Type >::getFlow ( int  iPos,
float *  pfTarget,
char *  pcDate 
)
template<class Type>
int CSOM< Type >::getFlowSize ( )
inline
template<class Type>
CKernel<Type>& CSOM< Type >::getKernel ( )
inline
template<class Type>
string CSOM< Type >::getLabel ( int  iNode)
template<class Type>
float CSOM< Type >::getMeta4Node ( int  iNode,
int  iPos 
)
inline
template<class Type>
Type CSOM< Type >::getNodeDistance ( int  iN1,
int  iN2 
)
template<class Type>
int CSOM< Type >::getNumNodes ( )
inline
template<class Type>
int CSOM< Type >::getNumSelectedNodes ( )
inline
template<class Type>
int CSOM< Type >::getNumVisibleNodes ( )
inline
template<class Type>
float CSOM< Type >::getProgress ( )
inline
template<class Type>
int CSOM< Type >::getSelectedNodes ( bool  bFirst)
template<class Type>
CLearnRate<Type>& CSOM< Type >::getSigmaRate ( )
inline
template<class Type>
int CSOM< Type >::getVisibleNode ( int  iPos)
inline
template<class Type>
CDataset<Type>& CSOM< Type >::metaData ( )
inline

Returns the meta data dataset containing some statistics like node sizes.

template<class Type>
Type CSOM< Type >::minimal_wiring ( CMetric< Type > &  cMetric)

Calculate minimal wiring.

Parameters
ctTestSetReference to a test set.
ctMetricReference to a metric.
template<class Type>
CDataset<double>& CSOM< Type >::nodeData ( )
inline
template<class Type>
bool CSOM< Type >::selectNode ( int  iNode,
bool  bSelect 
)
template<class Type>
void CSOM< Type >::setAlphaRate ( CLearnRate< Type > *  ptRate)

Set the learning rate for the learning stepwidth alpha

Parameters
ptRateThe new alpha rate.
template<class Type>
int CSOM< Type >::setCartesianTopology ( vector< int > &  rviNbUnits)

Initializes the position of the nodes in the output space. The function set the node vectors according to an equidistant grid, while the number of nodes in each dimension can be specified using rviNbUnits.

Parameters
rviNbUnitsReference to an vector holding the number of nodes/dimension.
template<class Type>
void CSOM< Type >::setDataMetric ( CMetric< Type > *  ptMetric)

Set the data metric

Parameters
ptMetricThe new metric to use for computation of distances in the data space - This is used to compute the best match node.
template<class Type>
void CSOM< Type >::setFlowItem ( int  iPos,
int *  piNodes,
char *  pcDate,
unsigned long  iTime 
)
template<class Type>
void CSOM< Type >::setFlowSize ( int  iNumItems)
template<class Type>
void CSOM< Type >::setGridMetric ( CMetric< double > *  ptMetric)

Set the grid metric

Parameters
ptMetricThe new metric to use.
template<class Type>
int CSOM< Type >::setHyperbolicTopology ( int  iNeighbours,
int  iRings,
int  iVisible = 3 
)

Initializes the position of the nodes in the output space. Places the nodes on a regular grid obtained by a tessellation of the hyperbolic plane H2 with congruent triangles.

Parameters
iNeighboursNumber of neighbours each node will have
iRingsNumber of rings around center node
iVisibleNumber of visible rings which are passed to VTK
template<class Type>
void CSOM< Type >::setKernel ( CKernel< Type > *  ptTheKernel)

Set the kernel for the neighborhood function.

Parameters
ptTheKernelThe new kernel to use for computation of h.
template<class Type>
void CSOM< Type >::setLabel ( int  iNode,
string  strLabel 
)
template<class Type>
void CSOM< Type >::setMetaData ( int  iPos,
Type *  ptTheData 
)
template<class Type>
void CSOM< Type >::setSigmaRate ( CLearnRate< Type > *  ptRate)

Set the rate for the neighborhood width

Parameters
ptRateThe new learning rate for the neighborhood parameter sigma.
template<class Type>
void CSOM< Type >::setUnit ( int  iNode,
CDenseVector< Type > &  rtVec 
)
template<class Type>
void CSOM< Type >::setUnitsAlongVectors ( vector< CDenseVector< Type > >  cVectors,
vector< Type >  cMin,
vector< Type >  cMax 
)

Initializes the position of the prototype vectors in the input space. The function set prototype vectors along the given vectors.

Parameters
rtDataReference to an CDataset.
template<class Type>
void CSOM< Type >::setUnitsFromDataset ( CDataset< Type > &  rtData)

Initializes the position of the prototype vectors in the input space. The function set prototype vectors according to a given dataset.

Parameters
rtDataReference to an CDataset.
template<class Type>
void CSOM< Type >::setUnitsFromDatasetRandom ( CDataset< Type > &  rtData)

Initializes the position of the prototype vectors in the input space. The function set prototype vectors according to a random selection of vectors from a given dataset.

Parameters
rtDataReference to an CDataset.
template<class Type>
void CSOM< Type >::setUpdateSteps ( int  iVal)
inline
template<class Type>
CSomTopology<Type>* CSOM< Type >::topologyPtr ( )
inline
template<class Type>
void CSOM< Type >::train ( CDataset< Type > &  tDataset)
virtual

Cluster given dataset

Parameters
tDatasetReference to dataset

Implements CClusterAlgorithm< Type >.

Referenced by CCartesianTopology< Type >::train().

template<class Type>
void CSOM< Type >::trainGrowing ( CDataset< Type > &  rtTrainSet,
float  fGrowParam 
)
inline
template<class Type>
void CSOM< Type >::trainTopology ( CDataset< Type > &  rtTrainSet)
inline
template<class Type>
void CSOM< Type >::uMat ( vector< Type > &  rvtDist,
Type  fNeighborhood 
)

Calculates the average inter-node distance between a reference vector and it neighbors in a given distance in the output space.

Parameters
rvtDistReference to a vector with the average inter-node distance.
fNeighborhoodRange of the neighborhood (default 1.0).

Friends And Related Function Documentation

template<class Type>
friend class CHyperbolicTopology< Type >
friend

Member Data Documentation

template<class Type>
vector<string> CSOM< Type >::vTopicNames

Meta data: topic names.


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