Skip to content
This repository has been archived by the owner on Aug 6, 2020. It is now read-only.

Commit

Permalink
matlab
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Wagner committed Jan 18, 2012
1 parent b3bcd78 commit e5f89a1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion m/models/eigenfaces.m
Expand Up @@ -24,7 +24,7 @@
Pca = pca(X, num_components); Pca = pca(X, num_components);


% build model % build model
model.name = "eigenfaces"; model.name = 'eigenfaces';
model.W = Pca.W; model.W = Pca.W;
model.num_components = num_components; model.num_components = num_components;
model.mu = Pca.mu; model.mu = Pca.mu;
Expand Down
2 changes: 1 addition & 1 deletion m/models/fisherfaces.m
Expand Up @@ -31,7 +31,7 @@
Lda = lda(project(X, Pca.W, Pca.mu), y, num_components); Lda = lda(project(X, Pca.W, Pca.mu), y, num_components);


% build model % build model
model.name = "lda"; model.name = 'lda';
model.mu = repmat(0, size(X,1), 1); model.mu = repmat(0, size(X,1), 1);
model.W = Pca.W*Lda.W; model.W = Pca.W*Lda.W;
model.P = model.W'*X; model.P = model.W'*X;
Expand Down
2 changes: 1 addition & 1 deletion m/models/lda.m
Expand Up @@ -49,7 +49,7 @@
V = V(:,idx); V = V(:,idx);


% build model % build model
model.name = "lda"; model.name = 'lda';
model.num_components = num_components; model.num_components = num_components;
model.W = V(:,1:(c-1)); model.W = V(:,1:(c-1));
end end
4 changes: 2 additions & 2 deletions m/models/pca.m
Expand Up @@ -14,7 +14,7 @@
%% .mu [dim x 1] sample mean of X %% .mu [dim x 1] sample mean of X
%% %%
%% Example: %% Example:
%% pca(X, y, struct("num_components",100)) %% pca(X, y, struct('num_components',100))
%% %%
if(nargin < 3) if(nargin < 3)
num_components=size(X,2)-1; num_components=size(X,2)-1;
Expand All @@ -26,7 +26,7 @@
[E,D,V] = svd(X ,'econ'); [E,D,V] = svd(X ,'econ');


% build model % build model
model.name = "pca"; model.name = 'pca';
model.W = E(:,1:num_components); model.W = E(:,1:num_components);
model.num_components = num_components; model.num_components = num_components;
model.mu = mu; model.mu = mu;
Expand Down

0 comments on commit e5f89a1

Please sign in to comment.