Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
timlautk authored Mar 6, 2018
1 parent 2dbc829 commit b85508f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
13 changes: 9 additions & 4 deletions bcd_dnn_mlp_cifar10_jinshan.m
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,15 @@
loss2(k) = loss2(k)+gamma1/2*norm(V1-max(U1,0),'fro')^2+gamma2/2*norm(V2-max(U2,0),'fro')^2+gamma3/2*norm(V3-max(U3,0),'fro')^2+gamma4/2*norm(V4-U4,'fro')^2;

% speed of learning
layer1(k) = norm(W1-W10,'fro');
layer2(k) = norm(W2-W20,'fro');
layer3(k) = norm(W3-W30,'fro');
layer4(k) = norm(W4-W40,'fro');
% layer1(k) = norm(W1-W10,'fro');
% layer2(k) = norm(W2-W20,'fro');
% layer3(k) = norm(W3-W30,'fro');
% layer4(k) = norm(W4-W40,'fro');

layer1(k) = norm(W1-W10,'fro')/norm(W10,'fro');
layer2(k) = norm(W2-W20,'fro')/norm(W20,'fro');
layer3(k) = norm(W3-W30,'fro')/norm(W30,'fro');
layer4(k) = norm(W4-W40,'fro')/norm(W40,'fro');

accuracy_train(k) = sum(pred'-1 == y_train)/N;
accuracy_test(k) = sum(pred_test'-1 == y_test)/N_test;
Expand Down
15 changes: 10 additions & 5 deletions bcd_dnn_mlp_mnist_jinshan.m
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,15 @@
loss2(k) = loss2(k)+gamma1/2*norm(V1-max(U1,0),'fro')^2+gamma2/2*norm(V2-max(U2,0),'fro')^2+gamma3/2*norm(V3-max(U3,0),'fro')^2+gamma4/2*norm(V4-U4,'fro')^2;

% speed of learning
layer1(k) = norm(W1-W10,'fro');
layer2(k) = norm(W2-W20,'fro');
layer3(k) = norm(W3-W30,'fro');
layer4(k) = norm(W4-W40,'fro');
% layer1(k) = norm(W1-W10,'fro');
% layer2(k) = norm(W2-W20,'fro');
% layer3(k) = norm(W3-W30,'fro');
% layer4(k) = norm(W4-W40,'fro');

layer1(k) = norm(W1-W10,'fro')/norm(W10,'fro');
layer2(k) = norm(W2-W20,'fro')/norm(W20,'fro');
layer3(k) = norm(W3-W30,'fro')/norm(W30,'fro');
layer4(k) = norm(W4-W40,'fro')/norm(W40,'fro');

accuracy_train(k) = sum(pred'-1 == y_train)/N;
accuracy_test(k) = sum(pred_test'-1 == y_test)/N_test;
Expand Down Expand Up @@ -295,7 +300,7 @@
set(graph3,'LineWidth',1.5);
l3 = legend('Hidden layer 1','Hidden layer 2','Hidden layer 3','Output layer','Location','northeast');
l3.Interpreter = 'latex';
ylabel('$\|W^{k}-W^{k-1}\|_F$','interpreter','latex')
ylabel('$\|W^{k}-W^{k-1}\|_F/\|W^{k-1}\|_F$','interpreter','latex')
xlabel('Epochs','interpreter','latex')
title('Speed of learning: Three-layer MLP','interpreter','latex')

Expand Down

0 comments on commit b85508f

Please sign in to comment.