Home | Develop | Download | Contact
pdsneuronml.h
1 /*
2  * pdsneuronml.h
3  *
4  * Copyright 2011 Fernando Pujaico Rivera <fernando.pujaico.rivera@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  */
22 
32 #ifndef __PDSNEURONML_H__
33 #define __PDSNEURONML_H__
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <pds/pdsnnglobal.h>
42 #include <pds/pdssn.h>
43 #include <pds/pdsnivector.h>
44 #include <pds/pdsnvector.h>
45 
46 
47 #ifndef TRUE
48  #define TRUE 1
49 #endif
50 
51 #ifndef FALSE
52  #define FALSE 0
53 #endif
54 
55 
74 typedef struct
75 {
80 
82  PdsNIVector *LayerInput;
85 
96 
98 
125 PdsNeuronML *pds_neuronml_new(const PdsVector *L);
126 
145 
167 PdsNeuronML *pds_neuronml_new_load_data(const char *mlayer_filename);
168 
169 
191 int pds_neuronml_save_data(const PdsNeuronML *NeuronML, const char *mlayer_filename);
192 
193 
195 
216 int pds_neuronml_set_max_error(PdsNeuronML *NeuronML,PdsNnReal MaxError);
217 
218 
230 
231 
239 
248 
257 
266 
275 
277 
292 int pds_neuronml_init_weight_uniform(PdsNeuronML *NeuronML,PdsUniform *RV);
293 
303 int pds_neuronml_init_weight_rand(PdsNeuronML *NeuronML,PdsSnReal min, PdsSnReal max);
304 
305 
313 int pds_neuronml_init_u_uniform(PdsNeuronML *NeuronML,PdsUniform *RV);
314 
315 
324 int pds_neuronml_init_u_rand(PdsNeuronML *NeuronML,PdsSnReal min, PdsSnReal max);
325 
327 
346 int pds_neuronml_iterate(PdsNeuronML *NeuronML,const PdsVector *Input,PdsVector *Output);
347 
357 
358 
367 PdsNnBool pds_neuronml_iterate_results_printf(const PdsNeuronML *MLayer,const char* Type);
368 
376 int pds_neuronml_get_output(const PdsNeuronML *NeuronML,PdsVector *Y);
377 
378 
389 int pds_neuronml_get_output_soft_vote(const PdsNeuronML *NeuronML,PdsNnReal *Vote);
390 
391 
392 
401 int pds_neuronml_get_output_rms_error(const PdsNeuronML *NeuronML,PdsNnReal *RmsError);
402 
404 
433 int pds_neuronml_training(PdsNeuronML *NeuronML,const PdsVector *Input,PdsVector *Output);
434 
444 
452 int pds_neuronml_set_alpha(PdsNeuronML *NeuronML,PdsNnReal Alpha);
453 
454 
456 
457 
471 int pds_neuronml_head_printf(const PdsNeuronML *NeuronML);
472 
473 
484 int pds_neuronml_head_fprintf(const PdsNeuronML *NeuronML, FILE *fd);
485 
493 
503 int pds_neuronml_body_fprintf(const PdsNeuronML *NeuronML, FILE *fd);
504 
505 
515 int pds_neuronml_body_fscanf(PdsNeuronML *NeuronML, FILE *fd);
516 
517 
526 int pds_neuronml_body_fwrite(const PdsNeuronML *NeuronML, FILE *fd);
527 
528 
537 int pds_neuronml_body_fread(PdsNeuronML *NeuronML, FILE *fd);
538 
540 
553 void pds_neuronml_free(PdsNeuronML *NeuronML);
554 
555 
562 void pds_neuronml_destroy(PdsNeuronML **NeuronML);
563 
565 
570 #ifdef __cplusplus
571 }
572 #endif
573 
574 #endif
575 
576 
int pds_neuronml_enable_printf(PdsNeuronML *NeuronML)
Habilita la muestra en pantalla del avance del aprendizaje.
PdsNnNatural MaxIter
Definition: pdsneuronml.h:91
PdsNnBool pds_neuronml_iterate_results_printf(const PdsNeuronML *MLayer, const char *Type)
Muestra los resultados de la iteración de la red neuronal multicapa NeuronML.
int pds_neuronml_set_max_error(PdsNeuronML *NeuronML, PdsNnReal MaxError)
Coloca el maximo margen error RMS aceptado en la salida de la estructura PdsNeuronML.
int pds_neuronml_get_output(const PdsNeuronML *NeuronML, PdsVector *Y)
Devuelve la salida Y de la red neuronal.
int pds_neuronml_init_weight_uniform(PdsNeuronML *NeuronML, PdsUniform *RV)
Inicializa todos los pesos usando una variable aleatoria uniforme.
PdsNeuronML * pds_neuronml_new_from_array(const PdsNnNatural *L, PdsNnNatural Nel)
Crea una estructura de tipo PdsNeuronML.
PdsNeuronML * pds_neuronml_new(const PdsVector *L)
Crea una estructura de tipo PdsNeuronML.
int pds_neuronml_set_alpha(PdsNeuronML *NeuronML, PdsNnReal Alpha)
Coloca el valor del factor de aprendizaje Alpha.
La estructura tipo PdsNeuronML . Esta estructura genera una red neuronal multi capa. Para usar incluir pds/pdsnn.h.
Definition: pdsneuronml.h:74
void pds_neuronml_free(PdsNeuronML *NeuronML)
Libera una neurona de tipo puntero PdsNeuronML.
PdsNnNatural Iter
Definition: pdsneuronml.h:93
int pds_neuronml_get_number_iterations(const PdsNeuronML *NeuronML, PdsNnNatural *Iter)
Devuelve el número de iteraciones del último entrenamiento hecho con la función pds_neuronml_training...
PdsNVector ** Layer
Definition: pdsneuronml.h:84
int pds_neuronml_body_fscanf(PdsNeuronML *NeuronML, FILE *fd)
Lee de un archivo de texto los pesos W[i], el valor de U. Ocupando una linea cada uno...
int pds_neuronml_get_minimum_output(PdsNeuronML *NeuronML, PdsNnReal *Min)
Retorna o valor maximo de las neuronas de salida.
int pds_neuronml_get_output_rms_error(const PdsNeuronML *NeuronML, PdsNnReal *RmsError)
Evalúa el error cuadrático medio de todos los errores Y[1] de las neuronas de salida de la red neuron...
PdsNIVector * LayerInput
Definition: pdsneuronml.h:82
PdsNnNatural * L
Definition: pdsneuronml.h:77
PdsNnReal Alpha
Definition: pdsneuronml.h:89
PdsNeuronML * pds_neuronml_new_head_fscanf(FILE *fd)
Lee los datos de cabecera de una red neuronal desde un archivo.
int pds_neuronml_init_weight_rand(PdsNeuronML *NeuronML, PdsSnReal min, PdsSnReal max)
Inicializa todos los pesos entre los valores min y max, usando internamente la funcion rand...
int pds_neuronml_head_fprintf(const PdsNeuronML *NeuronML, FILE *fd)
Escribe los datos de cabecera de la red neuronal. En una linea separando los elementos por un TAB...
int pds_neuronml_set_max_iterations(PdsNeuronML *NeuronML, PdsNnNatural MaxIter)
Coloca el máximo numero de iteraciones aceptado, cualquier valor mayor provoca que se detenga el algo...
unsigned int PdsNnNatural
Definition: pdsnnglobal.h:62
int pds_neuronml_get_maximum_output(PdsNeuronML *NeuronML, PdsNnReal *Max)
Retorna o valor maximo de las neuronas de salida.
int pds_neuronml_body_fwrite(const PdsNeuronML *NeuronML, FILE *fd)
Guarda en un archivo binario los pesos W[i], el valor de U. (neurona por neurona) ...
int pds_neuronml_iterate(PdsNeuronML *NeuronML, const PdsVector *Input, PdsVector *Output)
Itera la red neuronal multicapa NeuronML. .
PdsNnNatural N
Definition: pdsneuronml.h:79
float PdsNnReal
Definition: pdsnnglobal.h:52
int pds_neuronml_get_number_of_output_neurons(PdsNeuronML *NeuronML, PdsNnNatural *Number)
Retorna o numero de neuronas de salida.
void pds_neuronml_destroy(PdsNeuronML **NeuronML)
Libera una neurona de tipo puntero PdsNeuronML, y limpia el puntero con NULL.
int pds_neuronml_head_printf(const PdsNeuronML *NeuronML)
Mostra em pantalla los datos de cabecera de la red neuronal multicapa.
int pds_neuronml_get_number_of_input_neurons(PdsNeuronML *NeuronML, PdsNnNatural *Number)
Retorna o numero de neuronas de entrada.
int pds_neuronml_save_data(const PdsNeuronML *NeuronML, const char *mlayer_filename)
Salva una estructura de tipo PdsNeuronML en un archivo de texto.
PdsNeuronML * pds_neuronml_new_load_data(const char *mlayer_filename)
Crea una estructura de tipo PdsNeuronML e inicia todos los elementos. desde un archivo de texto...
int pds_neuronml_body_fprintf(const PdsNeuronML *NeuronML, FILE *fd)
Guarda en un archivo de texto los pesos W[i], el valor de U. Ocupando una linea cada uno...
int pds_neuronml_get_output_soft_vote(const PdsNeuronML *NeuronML, PdsNnReal *Vote)
Evalúa una votación con desición suave de los valores de salida de la red neuronal multicapa...
La estructura tipo PdsNVector . Esta estructura genera un arreglo de neuronas. Para usar incluir pds/...
Definition: pdsnvector.h:74
int pds_neuronml_training(PdsNeuronML *NeuronML, const PdsVector *Input, PdsVector *Output)
Entrena la red neuronal multicapa NeuronML. Usa el valor de Output como entrenamiento, para finalizar carga el nuevo valor de salida en Output.
unsigned char PdsNnBool
Definition: pdsnnglobal.h:68
PdsNnBool ShowPrintf
Definition: pdsneuronml.h:95
PdsNnReal MaxError
Definition: pdsneuronml.h:87
int pds_neuronml_init_u_rand(PdsNeuronML *NeuronML, PdsSnReal min, PdsSnReal max)
Inicializa todos los umbrales U de forma aleatoria entre min y max.
int pds_neuronml_init_u_uniform(PdsNeuronML *NeuronML, PdsUniform *RV)
Inicializa todos los umbrales U usando una variable aleatoria uniforme.
PdsNnNatural pds_neuronml_training_results_printf(PdsNeuronML *MLayer, const char *Type)
Muestra los resultados del entrenamiento de la red neuronal multicapa NeuronML.
int pds_neuronml_body_fread(PdsNeuronML *NeuronML, FILE *fd)
Lee de un archivo binario los pesos W[i], el valor de U. (neurona por neurona)

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed