Finding intrinsic dimensionality of data set
    4 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
Suppose I have a random (100,10) matrix. Here’s a code that gives the pca:
rng 'default'
 X=rand(100,10);
 X=bsxfun(@minus,X,mean(X));
 [coeff,score,latent]=pca(X);
 covmatrix=cov(X);
 [V,D]=eig(covmatrix); 
coeff
 V 
dataprincipalspace=X*coeff;
 score
 corrcoef(dataprincipalspace);
 var(dataprincipalspace)'
 latent 
sort(diag(D),'descend')
If now I wish to know the intrinsic dimension of it, what should I add to my code? Help is appreciated!
0 Commenti
Risposta accettata
  Gaurav Garg
    
 il 3 Feb 2020
        Hi,  
latent (column vector) stores the eigenvalues of the covariance matrix of X. 
Executing 
cumsum(latent/sum(latent))
would tell you the % of data variance in each dimension.
Finally, the number of dimensions will depend on how much variance you wish to have in your data.
For example, in your case it comes out to be ~ 94% of variance upto 9th dimension.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Dimensionality Reduction and Feature Extraction in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

