| 1 | /* Net_def.h |
| 2 | * |
| 3 | * Copyright (C) 2017-2018 Paul Boersma |
| 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. |
| 13 | * See the GNU 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 | #define ooSTRUCT RBMLayer |
| 21 | oo_DEFINE_CLASS (RBMLayer, Layer) |
| 22 | |
| 23 | oo_QUESTION (inputsAreBinary) |
| 24 | oo_MAT (weights, numberOfInputNodes, numberOfOutputNodes) |
| 25 | oo_VEC (inputBiases, numberOfInputNodes) |
| 26 | oo_VEC (outputBiases, numberOfOutputNodes) |
| 27 | |
| 28 | oo_VEC (inputReconstruction, numberOfInputNodes) |
| 29 | oo_VEC (outputReconstruction, numberOfOutputNodes) |
| 30 | |
| 31 | #if oo_DECLARING |
| 32 | void v_spreadUp (kLayer_activationType) |
| 33 | override; |
| 34 | void v_sampleInput () |
| 35 | override; |
| 36 | void v_spreadDown (kLayer_activationType) |
| 37 | override; |
| 38 | void v_spreadDown_reconstruction () |
| 39 | override; |
| 40 | void v_spreadUp_reconstruction () |
| 41 | override; |
| 42 | void v_update (double learningRate) |
| 43 | override; |
| 44 | void v_updateFirstPhase (double learningRate) |
| 45 | override; |
| 46 | void v_updateSecondPhase (double learningRate) |
| 47 | override; |
| 48 | autoMatrix v_extractInputReconstruction () |
| 49 | override; |
| 50 | autoMatrix v_extractOutputReconstruction () |
| 51 | override; |
| 52 | autoMatrix v_extractInputBiases () |
| 53 | override; |
| 54 | autoMatrix v_extractOutputBiases () |
| 55 | override; |
| 56 | autoMatrix v_extractWeights () |
| 57 | override; |
| 58 | autoMAT v_getWeights () |
| 59 | override; |
| 60 | #endif |
| 61 | |
| 62 | oo_END_CLASS (RBMLayer) |
| 63 | #undef ooSTRUCT |
| 64 | |
| 65 | |
| 66 | |
| 67 | #define ooSTRUCT InputLayer |
| 68 | oo_DEFINE_CLASS (InputLayer, Layer) |
| 69 | |
| 70 | oo_END_CLASS (InputLayer) |
| 71 | #undef ooSTRUCT |
| 72 | |
| 73 | |
| 74 | |
| 75 | #define ooSTRUCT FullyConnectedLayer |
| 76 | oo_DEFINE_CLASS (FullyConnectedLayer, Layer) |
| 77 | |
| 78 | oo_MAT (weights, numberOfInputNodes, numberOfOutputNodes) |
| 79 | oo_VEC (outputBiases, numberOfOutputNodes) |
| 80 | |
| 81 | #if oo_DECLARING &&0 |
| 82 | void v_spreadUp (kLayer_activationType) |
| 83 | override; |
| 84 | void v_update (double learningRate) |
| 85 | override; |
| 86 | autoMatrix v_extractOutputBiases () |
| 87 | override; |
| 88 | autoMatrix v_extractWeights () |
| 89 | override; |
| 90 | autoMAT v_getWeights () |
| 91 | override; |
| 92 | #endif |
| 93 | |
| 94 | oo_END_CLASS (FullyConnectedLayer) |
| 95 | #undef ooSTRUCT |
| 96 | |
| 97 | |
| 98 | |
| 99 | #define ooSTRUCT Net |
| 100 | oo_DEFINE_CLASS (Net, Daata) |
| 101 | |
| 102 | oo_OBJECT (LayerList, 0, layers) |
| 103 | |
| 104 | oo_END_CLASS (Net) |
| 105 | #undef ooSTRUCT |
| 106 | |
| 107 | |
| 108 | /* End of file Net_def.h */ |