-
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.
- Loading branch information
Showing
19 changed files
with
127 additions
and
183 deletions.
There are no files selected for viewing
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,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.
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,22 @@ | ||
|
||
%% Variational Bayesian for Gaussian Mixture Model | ||
close all; clear; | ||
d = 2; | ||
k = 3; | ||
n = 2000; | ||
[X,z] = mixGaussRnd(d,k,n); | ||
plotClass(X,z); | ||
m = floor(n/2); | ||
X1 = X(:,1:m); | ||
X2 = X(:,(m+1):end); | ||
% VB fitting | ||
[y1, model, L] = mixGaussVb(X1,10); | ||
figure; | ||
plotClass(X1,y1); | ||
figure; | ||
plot(L) | ||
% Predict testing data | ||
[y2, R] = mixGaussVbPred(model,X2); | ||
figure; | ||
plotClass(X2,y2); | ||
|
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,19 @@ | ||
clear; close all; | ||
|
||
d = 100; | ||
beta = 1e-1; | ||
X = rand(1,d); | ||
w = randn; | ||
b = randn; | ||
t = w'*X+b+beta*randn(1,d); | ||
x = linspace(min(X),max(X),d); % test data | ||
|
||
[model,llh] = linRegVb(X,t); | ||
% [model,llh] = rvmRegVb(X,t); | ||
plot(llh); | ||
[y, sigma] = linRegPred(model,x,t); | ||
figure | ||
plotCurveBar(x,y,sigma); | ||
hold on; | ||
plot(X,t,'o'); | ||
hold off |
File renamed without changes.
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,11 @@ | ||
%% Collapse Gibbs sampling for Dirichelt process gaussian mixture model | ||
close all; clear; | ||
d = 2; | ||
k = 3; | ||
n = 500; | ||
[X,label] = mixGaussRnd(d,k,n); | ||
plotClass(X,label); | ||
|
||
[y,model] = mixGaussGb(X); | ||
figure | ||
plotClass(X,y); |
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,13 @@ | ||
% demos for ch12 | ||
|
||
clear; close all; | ||
d = 3; | ||
m = 2; | ||
n = 1000; | ||
|
||
X = ppcaRnd(m,d,n); | ||
plotClass(X); | ||
|
||
%% Factor analysis | ||
[W, mu, psi, llh] = fa(X, m); | ||
plot(llh); |
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,13 @@ | ||
% demos for ch12 | ||
|
||
clear; close all; | ||
d = 3; | ||
m = 2; | ||
n = 1000; | ||
|
||
X = ppcaRnd(m,d,n); | ||
plotClass(X); | ||
|
||
%% EM probabilistic PCA | ||
[W,mu,beta,llh] = ppcaEm(X,m); | ||
plot(llh) |
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,13 @@ | ||
% demos for ch12 | ||
|
||
clear; close all; | ||
d = 3; | ||
m = 2; | ||
n = 1000; | ||
|
||
X = ppcaRnd(m,d,n); | ||
plotClass(X); | ||
|
||
%% Variational Bayesian probabilistic PCA | ||
[model, energy] = ppcaVb(X); | ||
plot(energy); |
File renamed without changes.
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,10 @@ | ||
|
||
%% adaboost | ||
d = 2; | ||
k = 2; | ||
n = 500; | ||
[X,t] = kmeansRnd(d,k,n); | ||
model = adaboostBin(X,t-1); | ||
y = adaboostBinPred(model,X); | ||
plotClass(X,y+1) | ||
|
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,14 @@ | ||
%% Mixture of linear regression | ||
close all; clear | ||
d = 1; | ||
k = 2; | ||
n = 500; | ||
[X,y] = mixLinRnd(d,k,n); | ||
plot(X,y,'.'); | ||
[label,model,llh] = mixLinReg(X, y, k); | ||
plotClass([X;y],label); | ||
figure | ||
plot(llh); | ||
[y_,z,p] = mixLinPred(model,X,y); | ||
figure; | ||
plotClass([X;y],label); |
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,10 @@ | ||
%% Mixture of logistic regression | ||
d = 2; | ||
c = 4; | ||
k = 4; | ||
n = 500; | ||
[X,t] = kmeansRnd(d,c,n); | ||
|
||
model = mixLogitBin(X,t-1,k); | ||
y = mixLogitBinPred(model,X); | ||
plotClass(X,y+1) |