Reputation: 797
I am following this http://www.pnas.org/content/suppl/2008/12/22/0802806106.DCSupplemental/0802806106SI.pdf to achieve spectral clustering
on my correlation matrix
. I have calculated eigenvalues/vectors
and have chosen the k-most (k=5
) significant pairs. The resulting matrix looks like this:
V1 V2 V3 V4 V5
-0.033 -0.099 -0.046 -0.014 -0.013
-0.010 0.012 0.069 0.087 0.002
0.010 -0.002 0.114 -0.053 -0.012
0.0023 0.001 -0.013 -0.006 -0.005
0.004 0.054 -0.011 0.090 -0.049
Now I need to "normalize each row to unit length"
. How do I go about that? From what I understand, I calculate the length of each row by taking the squareroot of the sum of each value in the row squared as |a|
then divide each value in the row by |a|
?
If that's the case, how then would I plot these 5 values in the Euclidean Space?
5D plot?
Most resources on the web I've found to do with normalizing to unit length deal with x,y,z
and can be plotted on a 3-D plot
.
Thanks.
Upvotes: 1
Views: 1117
Reputation: 25608
If your assumption is correct, you want
df_rn <- df / rowSums(sqrt(df^2))
rowSums(df_rn^2)
[1] 1 1 1 1 1
so all rows are now normalized by their l2 (euclidean) lengths.
Not much can be said about plotting in 5d: it is impossible. Usually 2d (rarely - 3d) projections are drawn. The question of projection plane is open; it depends on what are you trying to show.
Upvotes: 1