|
| 1 | +% %% Pipeline as outlined below by Jovo (via e-mail) |
| 2 | +% |
| 3 | +% 1) for each graph, compute the scaled sign positive graph laplacian of |
| 4 | +% each graph (call it L_i). one obtains this by filling in the diagonal of |
| 5 | +% each adjacency matrix by the degree of that vertex, divided by n-1 (this |
| 6 | +% is the expected weight of the self loop). |
| 7 | +% |
| 8 | +% 2) compute an svd of L_i for all i. look at the scree plots. |
| 9 | +% presumably, a relatively small number of eigenvalues should suffice to |
| 10 | +% capture most of the variance. |
| 11 | +% |
| 12 | +% 3) build a classifier using only the first d singular vectors. we |
| 13 | +% haven't really thought much about this, but svd implicitly assumes |
| 14 | +% gaussian noise, so, the optimal classifier under this assumption is a |
| 15 | +% discriminant classifier. the code i have in the repo for discriminant |
| 16 | +% classifiers is still in progress, but if you want to fix it up, that'd be |
| 17 | +% fine. report results for the discriminant classifiers (LDA and QDA, but |
| 18 | +% with diagonal covariance matrices and whitened covariance matrices). |
| 19 | +% |
| 20 | +% 4) cluster the singular vectors. do this by initializing with a |
| 21 | +% hierarchical clustering algorithm, and then use that to seed a k-means |
| 22 | +% algorithm. you can do this for a variety of values of k and d. choose |
| 23 | +% the one with the best BIC. marchette will send details for computing BIC |
| 24 | +% values here, and for implementing the "k-means" algorithm, which is, in |
| 25 | +% fact, more like a constrained finite gaussian mixture model algorithm. |
| 26 | +% |
| 27 | +% 5) given a particular choice of k and d, build a classifier. here, each |
| 28 | +% class is a mixture of gaussians, so a naive discriminant classifier is |
| 29 | +% insufficient. instead, one can implement a bayes plugin classifier. so, |
| 30 | +% given the fit of the mixture distributions for the two classes, compute |
| 31 | +% whether a test graph is closer to class 0 or class 1 distribution. |
| 32 | + |
| 33 | +%% Setup - Change to fit your desires |
| 34 | + |
| 35 | +% this is just where i load stuff from my computer |
| 36 | +load /users/dsussman/documents/MATLAB/Brain_graphs/BLSA79_data.mat; |
| 37 | + |
| 38 | +% you can set up stuff however you want here |
| 39 | + |
| 40 | +%% Step 1 - Compute Laplacians |
| 41 | +Ls = graph_laplacian(As); |
| 42 | + |
| 43 | +%% Step 2 - Compute SVDs and make scree plots |
| 44 | +[Us, Ss, Vs] = graph_svd(Ls); |
| 45 | +sz = size(Ss); |
| 46 | +singVals = zeros(sz(1),sz(3)); % col vectors of singular vals |
| 47 | +for k=1:sz(3) |
| 48 | + singVals(:,k) = diag(squeeze(Ss(:,:,k))); |
| 49 | +end |
| 50 | + |
| 51 | + |
| 52 | +% show scree plots of for all the graphs, red is targs is true blue is |
| 53 | +% targs is false |
| 54 | +figure(401); |
| 55 | +hold all; |
| 56 | +plot( singVals(:,targs==1), 'r'); |
| 57 | +plot( singVals(:,targs==0), 'b'); |
| 58 | + |
| 59 | +%% |
0 commit comments