Skip to content

Commit

Permalink
add batchTrain: runs a training set, calculates derivates and applies…
Browse files Browse the repository at this point in the history
… them
  • Loading branch information
nflip authored and marcoeilers committed Mar 16, 2012
1 parent d805ef5 commit 97f25de
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions handin3/batchTrain.m
@@ -0,0 +1,23 @@
function trained = batchTrain(Ws, tdata, acts, actD, allow, Lrate)

%% comments tbd

ins = tdata(:,1);
targets = tdata(:,2);

accPds = allow * 0;

for i = 1 : length(ins)
az = runNN(Ws, ins(i), acts);
As = az(:,1);
Zs = az(:,2);

deltas = findDeltas(Ws, actD, targets(i), Zs(length(Zs)), ...
As);

pds = partderivs(deltas, Zs, allow);
accPds = accPds + pds;
end

trained = modWs(Ws, Lrate, accPds);

0 comments on commit 97f25de

Please sign in to comment.