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 Feb 6, 2018
1 parent aa75b98 commit 773aafc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Algorithms/updateV_js.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function Vstar = updateV_js(U1,U2,W,b,rho,gamma,act)
[~,d] = size(W);
I = sparse(eye(d));
switch act
case 1
U1 = max(0,U1); % ReLU
case 2
U1 = tanh_proj(U1); % tanh
case 3
U1 = sigmoid_proj(U1); % sigmoid
end
% alpha = norm(eta2*(M2'*M2)+eta1*eye(d));
Vstar = (rho*(W'*W)+gamma*I)\(rho*W'*(U2-b)+gamma*U1);

end
6 changes: 6 additions & 0 deletions Algorithms/updateWb_js.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function [Wstar,bstar] = updateWb_js(U,V,W,b,alpha,rho)
[d,N] = size(V);
I = sparse(eye(d));
Wstar = (alpha*W+rho*(U-b)*V')/(alpha*I+rho*(V*V'));
bstar = (alpha*b+rho*sum(U-W*V,2))/(rho*N+alpha);
end
6 changes: 6 additions & 0 deletions Algorithms/updateWb_js_2.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function [Wstar,bstar] = updateWb_js_2(U,V,W,b)
[d,N] = size(V);
% I = sparse(eye(d));
Wstar = (U-b)*V'*pinv(V*V');
bstar = sum(U-W*V,2)/N;
end

0 comments on commit 773aafc

Please sign in to comment.