Skip to content

Instantly share code, notes, and snippets.

@maskaravivek maskaravivek/pca.m
Created May 23, 2020

What would you like to do?
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
You can’t perform that action at this time.