Plotting higher-dimensional data in two-dimensions which has already processed using supervised learning

4 views (last 30 days)
Hello,
So here is the challenge I am currently facing:
I have 100 points of five-dimensional data with 100 associated outcome measures (which are binary). I was able to determine well-fitting logistic regression coefficients where the logit transform exp(g(x))/(exp(g(x))+1) contains the generalized linear model g(x) = ax1+bx2+cx3+dx4+ex5+constant. The regression model was scaled to yield an output (risk) between 0 and 1.
With all of this in mind, I am looking for a way to plot the results on a 2D plot, perhaps using the output from the regression model (risk) as a color-code.
What I have tried so far: 1. Using PCA biplot vector to denote rate of increase (slope) of regression output (risk) based on each particular variable. This was a perfect idea except MATLAB's contouring requires a full-matrix of data and all I have are two PCA components with associated regression output (three vectors). 2. MDS for colorwashing but I would like to somehow include the magnitude of the contribution of each variable in the plot (something which, to my knowledge, MDS does not provide)
Thanks

Accepted Answer

Christopher Berry
Christopher Berry on 11 Aug 2014
Edited: Christopher Berry on 11 Aug 2014
James,
I think what you might be looking for is scatter coupled with specifying the MarkerColor as a vector corresponding to your linear regression output, g.
Let me show you what I mean using the example data from the biplot documentation (its also 5-dimensional data):
load carsmall
x = [Acceleration Displacement Horsepower MPG Weight];
x = x(all(~isnan(x),2),:);
[coefs,score] = pca(zscore(x));
Now, instead of using biplot, use scatter. The vector g would be the output of your regression model, but here I will just use a dummy vector the same length as my data.
s = 40; %Size of markers, can be a vector or a constant
g = linspace(1,10,length(coefs(:,1))); %Just a dummy g
scatter(coefs(:,1),coefs(:,2),s,g,'fill')
colorbar
You can also do something similar using the MarkerSize vector s, or scale both size and color simultaneously.
Also, this example is for plotting just the first 2 principal components, but if you want to visualize the first 3 principal components, you can use scatter3 and the same workflow described above.

More Answers (0)

Categories

Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!