Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added function findDeltas to find the deltas by backpropagation

  • Loading branch information...
commit 112b801b938a377e7cd1af822507877c5262e12b 1 parent cb105cd
nflip authored marcoeilers committed

Showing 1 changed file with 25 additions and 0 deletions. Show diff stats Hide diff stats

  1. +25 0 handin3/findDeltas.m
25 handin3/findDeltas.m
... ... @@ -0,0 +1,25 @@
  1 +function d = findDeltas(Ws, actD, target, out, As)
  2 +%%
  3 +%% finds deltas in backpropagation
  4 +%%
  5 +%% Arguments:
  6 +%% Ws: weights
  7 +%% actD: derivative of activation function for hidden layer
  8 +%% target: target value
  9 +%% out: output value of NN
  10 +%% As: vector of a_{i}
  11 +%%
  12 +%% Result:
  13 +%% d = vector of deltas. idx(0) and idx(1) will be 0
  14 +%%
  15 + lastIdx = size(Ws, 1)
  16 + d = [zeros(lastIdx - 1, 1); out-target];
  17 +
  18 +
  19 + %% find deltas only for hidden layer
  20 + for i = (lastIdx -1) : -1 : idx(2)
  21 + i
  22 + x = Ws(i+1:lastIdx, i) .* d(i+1:lastIdx)
  23 + d(i) = actD(As(i)) * sum(x)
  24 + end
  25 +

0 comments on commit 112b801

Please sign in to comment.
Something went wrong with that request. Please try again.