1
$\begingroup$

I have an $m\times n$ matrix $X$. To apply a Kernel PCA to my $X$ matrix I need to warp it into a function $K = \Phi(X)$.

The problem here is that $K$ get the size $m \times m$. If I'm doing projection with PCA.

% Average
mu = mean(K);

% Center data
Y = K - mu;

% PCA analysis
abort = input(sprintf('The size of the matrix is %ix%i. Do you want to apply PCA onto it? 1 = Yes, 0 = No: ', size(Y)));
if(abort == 1)
  [U, ~, ~] = svd(Y);
else
  error('Aborted');
end

% Projection
W = U(:, 1:c);
P = W'*Y;

Then the projected matrix $P$ is going to have the size $c \times m$.

Question:

I want the size of the projected matrix to have size $c \times n$. My goal is to turn $X$ into a lower dimension $c$ but keep the remaining columns $n$.

Am I using kernel PCA wrong?

$\endgroup$
0

1 Answer 1

0
$\begingroup$

Here is the answer:

  % Create kernel
  disp('Creating kernel');
  K = create_kernel(X, kernel_type, kernel_parameters);
  disp('Done');

  % Do PCA
  disp('Createing PCA of the kernel')
  [~, W] = mi.pca(K, c);

  % We projecting X onto W' instead of K onto W'
  P = W'*X;
  disp('Done');

Fully working example:

https://github.com/DanielMartensson/MataveID/blob/master/examples/kpcaExample.md

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.