I'm using the AMORE NN package to build multiple models from the same training set and i want to compare the weights between the models.
I'm pretty much an R newbie, but some of the stronger R users I know can't answer either.
here's the code:
library("AMORE") net <- newff(n.neurons=c(104,200,104), learning.rate.global=1e-2, momentum.global=0.5,error.criterium="LMS", Stao=NA, hidden.layer="tansig",output.layer="purelin", method="ADAPTgdwm") result <- train(net, x, y, error.criterium="LMS", report=TRUE, show.step=50, n.shows=20 )
net
is pretty easy to break out into some functions and I think input weights.
net$neurons
is where all the layer weights are. net$neurons
is a or list of length 304. net$neurons[n]
will print out what appears to be a set of units from the model. But it contains many things and I can't seem to get them out short of cut and paste.
I won't paste it all here – my model is pretty big as you can see and it goes on for several pages, but just to give you an idea:
net$neurons[1]
$type
[1] "output"
$activation.function
[1] 3
$output.links
[1] NA
$output.aims
[1] 103
$input.links
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
[19] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
[37] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
[55] 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
[73] 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
[91] 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
[109] 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
[127] 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
[145] 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
[163] 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
[181] 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
[199] 199 200$weights
[1] 7.767180e-03 -5.118608e-03 4.683484e-03 6.499882e-03 6.897404e-04
[6] 4.169454e-03 -5.282092e-05 9.589098e-04 7.031523e-03 6.669872e-03
[11] 2.716605e-03 -4.188492e-04 -4.141848e-03 -6.576378e-03 -6.812882e-03
[16] -3.511420e-03 -3.091805e-04 7.128892e-03 7.160105e-03 -8.050284e-03
[21] 3.386642e-03 2.579751e-03 7.065484e-03 1.872059e-04 1.829110e-03
[26] 7.472301e-03 -8.303545e-03 7.981113e-03 3.584151e-03 -4.432509e-03
[31] -8.705997e-04 -7.456132e-03 -9.884449e-04 7.523373e-03 -6.673688e-03
[36] -9.070783e-04 3.068912e-03 -8.045977e-04 -2.165867e-03 5.507719e-03
…
There's lots more, lots more, but it all has this general format.
Things that give no answer at all:
net$neuron[1]$weights net$neuron[1,"weights"] net$neuron[1,1] net$neuron[1]["weights"]
probably some of the above is laughably impossible anyway, but can anyone point me somewhere useful?
thanks
Best Answer
net$neuron[1][[1]][[7]]
first neuron, first list, element 7 are the weights
net$neuron[1][[1]][[8]]
element 8 is the bias
Similar Posts:
- Solved – Getting the weights to compare AMORE NN models
- Solved – Getting the weights to compare AMORE NN models
- Solved – Neural networks – how can I interpret what a hidden layer is doing to the data
- Solved – Neural networks – how can I interpret what a hidden layer is doing to the data
- Solved – Difference between dropout and neurons with 0 weights