The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Y.G. Bae (36) [Avatar] Offline
#1
Hello. There are multiple problems with the example for Gradient Descent Learning with Multiple Outputs.

(1) An Empty Network With Multiple Outputs
Because we are using scalar_ele_mul function in this example, pred should use this function as well, so the correct code would be:
def neural_network(inputs, weights):
    pred = scalar_ele_mul(input, weights)
    return pred


(2) PREDICT: Make a Prediction and Calculate Error and Delta & (3) COMPARE: Calculating Each "Weight Delta" and Putting It on Each Weight
The values of Delta & Error should be switched for both win? & sad? in the diagram:
pred[1] = 0.65 * 0.2 = 0.13
delta[1] = 0.13 - 1.0 = -0.87
error[1] = (-0.87) ** 2 = 0.757

pred[2] = 0.65 * 0.9 = 0.585
delta[2] = 0.585 - 0.1 = 0.485
error[2] = 0.485 ** 2 = 0.235


(3) COMPARE: Calculating Each "Weight Delta" and Putting It on Each Weight & (4) LEARN: Updating the Weights
weight_deltas should be input multiplied by deltas, not weights, so the correct code would be
weight_deltas = scalar_ele_mul(input, delta)