CS计算机代考程序代写 function cost = netbp2(neurons, data, labels, niter, lr, file)

function cost = netbp2(neurons, data, labels, niter, lr, file)
%Trains a neural network with 4 layers.

%Layer 2 and layer 4 have 2 neurons, layer 2 has neurons(1) and
%layer 3 has neurons(2)

%data is a matrix with two rows. data(:,i) contains the (x,y)
%coordinates of point i.

%labels is a matrix with two rows. labels(:,i) is [1;0]
%if data(:,i) is in category A and [0;1] if it is in category B.

%lr is learning rate

%niter is maximum number of iterations

%file is a filename where the file is created by
%save(file,’W2′,’W3′,’W4′,’b2′,’b3′,’b4′)

%cost is a vector storing the value of
%the cost function after each iteration; cost(j) is the cost at
%iteration j