Skip to content
Matlab code to compare the performance of principal component regression, linear regression and ridge regression
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
Z1_USCountiesAnalysis2_FinalResults.mat
Z1_USCountiesAnalysis2_Results_v2.mat
Z1_USCountiesAnalysis2_Results_v2_Comb.mat
Z1_USCountiesAnalysis2_v2.m
Z1_USCounties_holdouttest.m
calcRsq.m
counties_data.mat
counties_result.mat
createTestSet.m
createTestTrainSets_v2.m
datasample_alt.m
datasetGenerator.m
linearLS.m
linearRegression.m
matlab.mat
meanNormalize.m
meanVarsX.m
pcrFindNumComponents.m
plotStateData2.m
plotStateData3.m
plotX1X2_nameaxes.m
plotX1X2_nameaxes2.m
prinCompAnalysis.m
ridgeFindK.m
scaleX.m

README.md

Principal Component Analysis

Matlab code and data

Matlab code to compare the performance of principal component regression, linear regression and ridge regression in predicting the median household income

This code accompanies a paper on Principal Component Analysis (PCA). It explains what PCA is, the underlying mathematics and explores when it is and is not useful for data analysis. See www.learningmachinelearning.org to access the paper

run Z1_USCountiesAnalysis2_v2.m then Z1_USCounties_holdouttest.m to run the analysis

Dependencies: Matlab Statistical and machine learning tool box. Functions used from this tool box

  • datasample
    • datasample_alt.m is an alternative implementation to the toolbox function. To use this change line 15 of creatTestTrainSets_v2.m and line 6 of createTestSet.m
  • fitlm
  • ridge
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.