00001 /* 00002 * Copyright (c) 2007. The BATI team. All right reserved. 00003 * 00004 * This file is part of BATI library. 00005 * 00006 * BATI library is free software: you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * BATI library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with BATI library. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00023 /*------------------------------------------------------------*/ 00024 /* */ 00025 /* Kohonen Circular Self Organizing Map Neural Network header */ 00026 /* */ 00027 /* author: Petre Rodan <rodan@subdimension.com> */ 00028 /* */ 00029 /*------------------------------------------------------------*/ 00030 00036 #ifndef __csom_H__ 00037 #define __csom_H__ 00038 00039 #ifdef __cplusplus 00040 # define BEGIN_C_DECLS extern "C" { 00041 # define END_C_DECLS } 00042 #else 00043 # define BEGIN_C_DECLS 00044 # define END_C_DECLS 00045 #endif 00046 00047 #include "image.h" 00048 #include "proto2D.h" 00049 00050 BEGIN_C_DECLS 00051 00052 typedef struct { 00053 int input_neurons; /* number of input level neurons*/ 00054 int output_neurons; /* number of output level neurons */ 00055 int element; /* number of elements in every attribute */ 00056 int max_neigh; /* how many neurons share the winning (on each side of the winner) */ 00057 int max_epoch; /* how many itterations to perform */ 00058 char random_init; /* use random init or not */ 00059 char rescale_sw; /* rescale the input space or not */ 00060 float max_learn_rate; /* initial value of learning rate */ 00061 float **x; /* the input attributes */ 00062 float **w; /* the coefficients for first element of input vector */ 00063 float **w_new; /* new coefficients */ 00064 float *learn_rate; /* function of learning rate */ 00065 float *neigh_rate; /* function of neighborhood */ 00066 int *csom_out; /* output vector of csom */ 00067 /* internal data */ 00068 int element_current; /* current vector */ 00069 int epoch; /* current epoch */ 00070 float *d; /* distances */ 00071 /* debugging */ 00072 int *activations; /* how many times was a neuron activated */ 00073 float evolution; /* the changes of coefficients between 2 epochs */ 00074 } csom_t; 00075 00076 00077 extern param *csom_lect(csom_t *csom, param *ptp, char *debq); 00078 extern int csom_init(csom_t *csom); 00079 extern int csom_calc(csom_t *csom); 00080 extern int csom_destruct(csom_t *csom); 00081 00082 extern int imau1tocsomvect(float **data, int nb_attr, ...); 00083 extern int csomvecttoimau1(csom_t *csom, int dimX, int dimY, imau1 *imres); 00084 00085 END_C_DECLS 00086 00087 #endif