Functions

src/som.c File Reference

#include "som.h"
#include "distances.h"
#include "mathadd.h"
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>

Go to the source code of this file.

Functions

void som_free (Som *s)
double ** som_generate_connectivity_matrix (SOMConnectivityType type, double **m, int n)
Somsom_init (int dimension, int n, int nruns, SOMConnectivityType connectivity_type)
void som_initialize_random (Som *s, double min, double max)
void som_initialize_random_samples (Som *s, double **X, int dim, int nsamples)
double som_neighbourhood_gaussian (int x, int bmu, struct som_struct *s, int t)
void som_print (FILE *f, Som *s)
double som_time_decay_linear (int t, int nruns, int initial_runs)
void som_train_from_data (Som *s, double **X, int dim, int nsamples)

Function Documentation

void som_free ( Som s  ) 

Definition at line 133 of file som.c.

double** som_generate_connectivity_matrix ( SOMConnectivityType  type,
double **  m,
int  n 
)

generate a connectivity matrix of type type. The (i,j)th entry gives the distance between nodes i and j in number of nodes.

type:

  • ONED_LINEAR:$ m_{i,j} = | i-j | $
  • TWOD_GRID: n should be a square number and$ m_{i,j} = $
  • TWOD_HEXAGONAL:
Parameters:
type 
m if NULL or ALLOC_IN_FCT, allocate own memory.
n number of nodes

Definition at line 40 of file som.c.

Som* som_init ( int  dimension,
int  n,
int  nruns,
SOMConnectivityType  connectivity_type 
)

allocate the Som-struct

Definition at line 103 of file som.c.

void som_initialize_random ( Som s,
double  min,
double  max 
)

initialize the codebook vectors with random values between min and max (uniformely drawn);

Definition at line 237 of file som.c.

void som_initialize_random_samples ( Som s,
double **  X,
int  dim,
int  nsamples 
)

initialize the codebook vectors with randomly drawn samples from the data X;

Parameters:
s the model
X data of dimension [dim, nsamples]

Definition at line 254 of file som.c.

double som_neighbourhood_gaussian ( int  x,
int  bmu,
struct som_struct *  s,
int  t 
)

Gaussian neighbourhood (std shrinks exponentially with t).

Definition at line 166 of file som.c.

void som_print ( FILE *  f,
Som s 
)

Definition at line 269 of file som.c.

double som_time_decay_linear ( int  t,
int  nruns,
int  initial_runs 
)

Linear time-decay function between 0 and 1.

Definition at line 151 of file som.c.

void som_train_from_data ( Som s,
double **  X,
int  dim,
int  nsamples 
)

apply SOM-training rule

\[ m_i(t+1) = m_i(t) + h_{ci}(t)[ x(t) - m_i(t) ] \]

Definition at line 184 of file som.c.