| 1 |
/* FFNet_def.h |
| 2 |
* |
| 3 |
* Copyright (C) 1994-2018 David Weenink |
| 4 |
* |
| 5 |
* This code is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or (at |
| 8 |
* your option) any later version. |
| 9 |
* |
| 10 |
* This code is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
/* |
| 20 |
djmw 19961104 |
| 21 |
djmw 20020712 GPL header |
| 22 |
djmw 20060529 Added version number to oo_Collection |
| 23 |
djmw 20080122 float -> double |
| 24 |
*/ |
| 25 |
|
| 26 |
#define ooSTRUCT FFNet |
| 27 |
oo_DEFINE_CLASS (FFNet, Daata) |
| 28 |
|
| 29 |
oo_INTEGER (numberOfLayers) /* number of layers */ |
| 30 |
oo_FROM (1) |
| 31 |
oo_INTEGER (numberOfInputs) |
| 32 |
oo_INTEGER (numberOfOutputs) |
| 33 |
oo_ENDFROM |
| 34 |
#if oo_READING |
| 35 |
oo_VERSION_UNTIL (1) |
| 36 |
oo_INTVEC (numberOfUnitsInLayer, numberOfLayers + 1) |
| 37 |
numberOfInputs = numberOfUnitsInLayer [1]; |
| 38 |
numberOfOutputs = numberOfUnitsInLayer [numberOfLayers + 1]; |
| 39 |
for (integer ilayer = 1; ilayer <= numberOfLayers; ilayer ++) |
| 40 |
numberOfUnitsInLayer [ilayer] = numberOfUnitsInLayer [ilayer + 1]; |
| 41 |
numberOfUnitsInLayer. resize (numberOfLayers); |
| 42 |
oo_VERSION_ELSE |
| 43 |
oo_INTVEC (numberOfUnitsInLayer, numberOfLayers) |
| 44 |
oo_VERSION_END |
| 45 |
#else |
| 46 |
oo_INTVEC (numberOfUnitsInLayer, numberOfLayers) |
| 47 |
#endif |
| 48 |
oo_INT (outputsAreLinear) |
| 49 |
oo_INT (nonLinearityType) |
| 50 |
oo_INT (costFunctionType) |
| 51 |
oo_COLLECTION (Categories, outputCategories, SimpleString, 0) |
| 52 |
oo_INTEGER (numberOfWeights) /* number of weights */ |
| 53 |
oo_VEC (w, numberOfWeights) |
| 54 |
|
| 55 |
#if ! oo_READING && ! oo_WRITING && ! oo_COMPARING |
| 56 |
oo_INTEGER (numberOfNodes) |
| 57 |
oo_INTEGER (dimension) |
| 58 |
|
| 59 |
#if oo_DECLARING |
| 60 |
double (*nonLinearity) (FFNet me, double x, double *deriv); |
| 61 |
void *nlClosure; |
| 62 |
double (*costFunction) (FFNet me, constVEC const& target); |
| 63 |
void *cfClosure; |
| 64 |
#endif |
| 65 |
|
| 66 |
#if oo_DECLARING |
| 67 |
oo_DOUBLE (accumulatedCost) |
| 68 |
oo_INTEGER (numberOfPatterns) |
| 69 |
oo_INTEGER (currentPattern) |
| 70 |
MAT inputPattern, targetActivation; |
| 71 |
#endif |
| 72 |
#if oo_DECLARING || oo_DESTROYING |
| 73 |
oo_OBJECT (Minimizer, 0, minimizer) |
| 74 |
#endif |
| 75 |
|
| 76 |
oo_VEC (activity, numberOfNodes) |
| 77 |
oo_INTVEC (isbias, numberOfNodes) |
| 78 |
oo_INTVEC (nodeFirst, numberOfNodes) |
| 79 |
oo_INTVEC (nodeLast, numberOfNodes) |
| 80 |
oo_INTVEC (wFirst, numberOfNodes) |
| 81 |
oo_INTVEC (wLast, numberOfNodes) |
| 82 |
|
| 83 |
oo_VEC (deriv, numberOfNodes) |
| 84 |
oo_VEC (error, numberOfNodes) |
| 85 |
oo_INTVEC (wSelected, numberOfWeights) |
| 86 |
oo_VEC (dw, numberOfWeights) |
| 87 |
oo_VEC (dwi, numberOfWeights) |
| 88 |
#endif |
| 89 |
|
| 90 |
#if oo_READING |
| 91 |
bookkeeping (this); |
| 92 |
FFNet_setNonLinearity (this, nonLinearityType); |
| 93 |
FFNet_setCostFunction (this, costFunctionType); |
| 94 |
#endif |
| 95 |
|
| 96 |
#if oo_COPYING |
| 97 |
thy nonLinearity = our nonLinearity; |
| 98 |
thy nlClosure = our nlClosure; |
| 99 |
thy costFunction = our costFunction; |
| 100 |
thy cfClosure = our cfClosure; |
| 101 |
#endif |
| 102 |
|
| 103 |
#if oo_DECLARING |
| 104 |
void v1_info () |
| 105 |
override; |
| 106 |
#endif |
| 107 |
|
| 108 |
oo_END_CLASS (FFNet) |
| 109 |
#undef ooSTRUCT |
| 110 |
|
| 111 |
/* End of file FFNet_def.h */ |