function [newW, newV, Ehist, Chist] = bprop2(X,W,V,D,eta,iters)
% [newW, newV, Ehist, Chist] = bprop2(X,W,V,D,eta,iters)
%   X is n x N, where each column is a data sample.
%   W is h x (n+1), giving the weights to the hidden units and their biases.
%   V is m x (h+1), giving the weights to the output units and their biases.
%   D is m x N, giving the desired ouput values for each sample.
%   eta is the learning rate.
%   iters is the number of weight updates.
%
%   newW and newV are the network weights after learning.
%   Ehist is a vector of normalized error values, one for each step.
%   Chist is a vector of percentage of correct classifications, one for each step.

 Xp = [ -ones(1,size(X,2)); X ];
 Ehist=zeros(1,iters);
 Chist=zeros(1,iters);

 for i=1:iters
  Z = % FILL THIS IN
  Y = % FILL THIS IN
  Ehist(i) = 0.5 * sum(sum( (Y-D).^2 )) / size(X,2);
  Chist(i) = sum(prod(abs(Y-D)<.2)) / size(X,2);
  eY = % FILL THIS IN
  eZ = % FILL THIS IN
  dV = % FILL THIS IN
  dW = % FILL THIS IN
  V = V - eta * dV;
  W = W - eta * dW;
 end
 newW = W;
 newV = V; 

 
