%% MAIN SVD % We use data from a CCA model that we run using the toolkit, so as to make % sure that we respect the train and test sets appropriately. clear % Change the two directories to where the main model is, % abcdAll_noA\framework\spls_fair20-5_fair_modeA_pub_noAnom_new_common_bmi, % as well as to where the main SVD model is, % abcdAll_noA\framework\cca_holdout1-0.20_common_PCA_CCA_9_correct_outmat. svd_framework = 'C:\Users\Konstantinos Tsirlis\Dropbox\My Desktop\Mourao - Miranda\ABCD results\abcdAll_noA\framework\cca_holdout1-0.20_common_PCA_CCA_9_correct_outmat'; main_framework = 'C:\Users\Konstantinos Tsirlis\Dropbox\My Desktop\Mourao - Miranda\ABCD results\abcdAll_noA\framework\spls_fair20-5_fair_modeA_pub_noAnom_new_common_bmi'; cd([svd_framework '\load\svd']); clear svd_framework to_load = dir('tr_svd*'); load(to_load(1).name); clear to_load explained_var = sqrt(LY); explained_var = explained_var*100/sum(explained_var); % Compute correlations between (only the non-zero) SPLS weights and the SVD weights cd([main_framework '\res']); spls_weights_svd_correl = []; spls_loadings_svd_correl = []; for j = 1:length(dir('level*')) cd([main_framework '\res\level' num2str(j)]); model = dir('model*'); load(model.name,'wY'); clear model load('corrCell.mat') for i = 1:size(VY,2) spls_loadings_svd_correl(i,j) = corr(VY(:,i),corrCell{1,2}'); spls_weights_svd_correl(i,j) = corr(VY(find(wY),i),wY(find(wY))'); end %i clear wY corrCell end %j cd([main_framework '\res']); save('svd_correl.mat','spls_loadings_svd_correl','spls_weights_svd_correl','explained_var')