00001 /*************************************************************************** 00002 * @file gnn_dataset.h 00003 * @brief Data sets Header File. 00004 * 00005 * @date : 23-08-03 21:12, 22-09-03 02:28 00006 * @author : Pedro Ortega C. <peortega@dcc.uchile.cl> 00007 * Copyright 2003 Pedro Ortega C. 00008 ****************************************************************************/ 00009 /* 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 */ 00024 00025 #ifndef _GNN_DATASET_H_ 00026 #define _GNN_DATASET_H_ 00027 00028 00029 00030 /******************************************/ 00031 /* Include Files */ 00032 /******************************************/ 00033 00034 #include "gnn_globals.h" 00035 #include "gnn_input.h" 00036 00037 00038 00039 /******************************************/ 00040 /* Typedefs */ 00041 /******************************************/ 00042 00043 /** 00044 * @brief The datatype for dataset reset functions. 00045 * @ingroup gnn_dataset_doc 00046 * 00047 * This is the datatype that contains the basic elements for the implementation 00048 * of a dataset. Every new type of dataset should extend this structure. 00049 */ 00050 typedef struct _gnn_dataset gnn_dataset; 00051 00052 /** 00053 * @brief The datatype for dataset reset functions. 00054 * @ingroup gnn_dataset_doc 00055 * 00056 * This function type defines the form of the "reset" functions for datasets. 00057 * A "reset" function should prepare the internal properties for begin a new 00058 * sequence of pattern drawings. 00059 * 00060 * "reset" is usually called after the end of an epoch has been reached. 00061 */ 00062 typedef int (*gnn_dataset_reset_type) (gnn_dataset *set); 00063 00064 /** 00065 * @brief The datatype for dataset get functions. 00066 * @ingroup gnn_dataset_doc 00067 * 00068 * This function type defines the form of the "get" functions for datasets. 00069 * A "get" function should return the k-th pattern full pattern (that is, 00070 * its input and output vectors, and its weight). The index "k" depends on 00071 * the specific dataset. 00072 */ 00073 typedef int (*gnn_dataset_get_type) (gnn_dataset *set, 00074 size_t k, 00075 gsl_vector **x, 00076 gsl_vector **t, 00077 double *p); 00078 00079 typedef void (*gnn_dataset_destroy_type) (gnn_dataset *set); 00080 00081 struct _gnn_dataset 00082 { 00083 size_t size; /**< The number of patterns in the dataset. */ 00084 size_t n; /**< The size of the input patterns. */ 00085 size_t m; /**< The size of the output patterns. */ 00086 gnn_dataset_reset_type reset; /**< The "reset" function pointer. */ 00087 gnn_dataset_get_type get; /**< The "get" function pointer. */ 00088 gnn_dataset_destroy_type destroy; /**< The "destroy" function pointer. */ 00089 }; 00090 00091 00092 00093 /******************************************/ 00094 /* Public Interface */ 00095 /******************************************/ 00096 00097 int 00098 gnn_dataset_init (gnn_dataset *set, 00099 size_t size, 00100 size_t n, 00101 size_t m, 00102 gnn_dataset_reset_type reset, 00103 gnn_dataset_get_type get, 00104 gnn_dataset_destroy_type destroy); 00105 00106 void 00107 gnn_dataset_destroy (gnn_dataset *set); 00108 00109 int 00110 gnn_dataset_reset (gnn_dataset *set); 00111 00112 int 00113 gnn_dataset_get (gnn_dataset *set, 00114 size_t k, 00115 gsl_vector **x, 00116 gsl_vector **t, 00117 double *p); 00118 00119 size_t 00120 gnn_dataset_get_size (gnn_dataset *set); 00121 00122 size_t 00123 gnn_dataset_input_get_size (gnn_dataset *set); 00124 00125 size_t 00126 gnn_dataset_output_get_size (gnn_dataset *set); 00127 00128 00129 00130 #endif /* _GNN_DATASET_H_ */ 00131 00132 00133
1.2.18