Principle components analysis

From Knowledge Discovery

Jump to: navigation, search

For most larger problems, you will need to compute the dominant eigenvalues. The following matlab code(from the sparse library) does this.

function [U,S,V,flag] = svds(varargin)

%SVDS Find a few singular values and vectors.

  If A is M-by-N, SVDS(A,...) manipulates a few eigenvalues and vectors
  returned by EIGS(B,...), where B = [SPARSE(M,M) A; A' SPARSE(N,N)],
  to find a few singular values and vectors of A.  The positive
  eigenvalues of the symmetric matrix B are the same as the singular
  values of A.
  S = SVDS(A) returns the 6 largest singular values of A.
 S = SVDS(A,K) computes the K largest singular values of A.
  S = SVDS(A,K,SIGMA) computes the K singular values closest to the 
  scalar shift SIGMA.  For example, S = SVDS(A,K,0) computes the K
  smallest singular values.
  S = SVDS(A,K,'L') computes the K largest singular values (the default).
  S = SVDS(A,K,SIGMA,OPTIONS) sets some parameters (see EIGS):
Personal tools