Skip to content

Instantly share code, notes, and snippets.

@maskaravivek
Created May 23, 2020 00:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maskaravivek/9baae5b20ae914ab73cc42ca224a4dc6 to your computer and use it in GitHub Desktop.
Save maskaravivek/9baae5b20ae914ab73cc42ca224a4dc6 to your computer and use it in GitHub Desktop.
featureMatrix = normalize(featureMatrix); % Normalize the feature matrix
% No of dimensions to keep
numberOfDimensions = 5;
[COEFF, SCORE, LATENT, TSQUARED, EXPLAINED] = pca(featureMatrix); % Perform PCA analysis
reducedDimension = COEFF(:,1:numberOfDimensions);
reducedFeatureMatrix = featureMatrix * reducedDimension;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment