Skip to content

Commit

Permalink
pca
Browse files Browse the repository at this point in the history
  • Loading branch information
sth4nth committed Dec 18, 2015
1 parent 1d8a8d8 commit 4af6301
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions chapter06/demo.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
% maxabsdiff(y_kn,y_lin)
% maxabsdiff(sigma_kn,sigma_lin)
% maxabsdiff(p_kn,p_lin)
%% kernel PCA with linear kernel is PCA
% clear; close all;
% n = 100;
%% test case for knCenter
% kn = @knGauss;
% X=rand(2,100);
Expand Down
2 changes: 1 addition & 1 deletion chapter06/knKmeans.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function [label, energy, model] = knKmeans(X, init, kn)
% Perform kernel k-means clustering.
% K: nxn kernel matrix
% k: number of cluster
% init: either number of clusters or initial label
% Reference: Kernel Methods for Pattern Analysis
% by John Shawe-Taylor, Nello Cristianini
% Written by Mo Chen ([email protected]).
Expand Down
6 changes: 5 additions & 1 deletion chapter06/knPca.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
function [ R, Z, err ] = knPca( X, d, kn )
function [ R, Z, err, model] = knPca(X, d, kn)
% Kernel PCA
% X: dxn data matrix
% d: target dimension
% kn: kernel function
% Written by Mo Chen ([email protected]).
if nargin < 3
kn = @knGauss;
end
Expand Down
10 changes: 6 additions & 4 deletions chapter06/knPcaPred.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
function [ output_args ] = knPcaPred( input_args )
%KNPCAPRED Summary of this function goes here
% Detailed explanation goes here
function X = knPcaPred(model, Xt)
% Prediction for kernel PCA
% model: trained model structure
% X: d x n testing data
% t (optional): 1 x n testing response
% Written by Mo Chen ([email protected]).


end

0 comments on commit 4af6301

Please sign in to comment.