Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void NNetwork::propigateActivations(){
- /*
- This is the math I am using
- [W1 W2 [I1, I2, B1]
- W3 W4
- W5 W6]
- H1 = I1*W1 + I2*W3 + B1*W5
- H2 = I1*W2 + I2*W4 + B1*W6
- */
- // Calculate the activations for the hidden layer
- for (int i = 0; i < hidUnits - 1; i++) {
- for (int j = 0; j < inUnits; j++) {
- nNetwork->hiddenLayer.x[i] += nNetwork->inputLayer.w[j][i] * nNetwork->inputLayer.x[j];
- }
- }
- // Use the the Sigmoid function: on the hidden layer
- for(int i = 0; i < hidUnits - 1; i++){
- // fast sigmoid algorithm is f(x) = x / (1 + abs(x))
- nNetwork->hiddenLayer.x[i] = nNetwork->hiddenLayer.x[i] / (1 + abs(nNetwork->hiddenLayer.x[i]));
- }
- // Set bias node for hidden layer to 1.0
- nNetwork->hiddenLayer.x[hidUnits - 1] = 1.0;
- // Calculate the activations for the output layer
- for (int i = 0; i < outUnits; i++) {
- for (int j = 0; j < hidUnits; j++) {
- nNetwork->outputLayer.x[i] += nNetwork->hiddenLayer.w[j][i] * nNetwork->hiddenLayer.x[j];
- }
- }
- // Use the the Sigmoid function: on the output layer
- for(int i = 0; i < outUnits; i++){
- // fast sigmoid algorithm is f(x) = x / (1 + abs(x))
- nNetwork->outputLayer.x[i] = nNetwork->outputLayer.x[i] / (1 + abs(nNetwork->outputLayer.x[i]));
- }
Add Comment
Please, Sign In to add comment