-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from sth4nth/master
extracted demos
- Loading branch information
Showing
60 changed files
with
636 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
TODO: | ||
ch08: BP | ||
ch10: EP | ||
|
||
ch13: LDS stability | ||
ch05: MLP bias |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
function y = logGauss(X, mu, Sigma) | ||
function y = logGauss(X, mu, sigma) | ||
% Compute log pdf of a Gaussian distribution. | ||
% Input: | ||
% X: d x n data matrix | ||
% mu: d x 1 mean vector of Gaussian | ||
% Sigma: d x d covariance matrix of Gaussian | ||
% sigma: d x d covariance matrix of Gaussian | ||
% Output: | ||
% y: 1 x n probability density in logrithm scale y=log p(x) | ||
% Written by Mo Chen ([email protected]). | ||
[d,k] = size(mu); | ||
assert(all(size(Sigma)==d) && k==1) % one mu and one dxd Sigma | ||
X = bsxfun(@minus,X,mu); | ||
[R,p]= chol(Sigma); | ||
if p ~= 0 | ||
error('ERROR: Sigma is not PD.'); | ||
end | ||
Q = R'\X; | ||
q = dot(Q,Q,1); % quadratic term (M distance) | ||
c = d*log(2*pi)+2*sum(log(diag(R))); % normalization constant | ||
y = -0.5*(c+q); | ||
|
||
if all(size(sigma)==d) && k==1 % one mu and one dxd sigma | ||
X = bsxfun(@minus,X,mu); | ||
[R,p]= chol(sigma); | ||
if p ~= 0 | ||
error('ERROR: sigma is not PD.'); | ||
end | ||
Q = R'\X; | ||
q = dot(Q,Q,1); % quadratic term (M distance) | ||
c = d*log(2*pi)+2*sum(log(diag(R))); % normalization constant | ||
y = -0.5*(c+q); | ||
elseif size(sigma,1)==1 && size(sigma,2)==size(mu,2) % k mu and (k or one) scalar sigma | ||
X2 = repmat(dot(X,X,1)',1,k); | ||
D = bsxfun(@plus,X2-2*X'*mu,dot(mu,mu,1)); | ||
q = bsxfun(@times,D,1./sigma); % M distance | ||
c = d*(log(2*pi)+2*log(sigma)); % normalization constant | ||
y = -0.5*bsxfun(@plus,q,c); | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function y = mlpPred(model, X) | ||
% Multilayer perceptron prediction | ||
% Input: | ||
% model: model structure | ||
% X: d x n data matrix | ||
% Ouput: | ||
% Y: p x n response matrix | ||
% Written by Mo Chen ([email protected]). | ||
W = model.W; | ||
L = length(W)+1; | ||
Z = cell(L); | ||
Z{1} = X; | ||
for l = 2:L | ||
Z{l} = sigmoid(W{l-1}'*Z{l-1}); | ||
end | ||
y = Z{L}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(1) test against matlab implementation of kalman filter | ||
(2) simplify ldsEm with less parameters (G=diag(g), S=I) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.