Commit 5fa11810 authored by Sam Harrison's avatar Sam Harrison
Browse files

Add amplitude variability and scoring

 + Add variability in amplitudes to simulations.
 + Test for this as part of scoring procedures.
 + Load inferred PROFUMO amplitudes.
parent 3178ef1a
......@@ -21,21 +21,19 @@ switch options.An.form
end
%If the option has been specified, turn some networks off
if isfield(options.An, 'offRate')
%Loop over subjects and networks
for s = 1:params.S
for n = 1:params.N
%Randomly eliminate some timecourses
if rand < options.An.offRate
for r = 1:params.R(s)
An{s}{r}(n,:) = 0;
end
end
end
% Add amplitude variability
% And if the option has been specified, turn some networks off
for s = 1:params.S
if isfield(options.An, 'offRate')
on = (rand(params.N, 1) > options.An.offRate);
else
on = ones(params.N, 1);
end
for r = 1:params.R(s)
amp = gamrnd( ...
options.An.amp.a, 1.0 / options.An.amp.b, params.N, 1);
An{s}{r} = An{s}{r} .* (amp .* on);
end
end
%Finally, add a global rescaling such that all timecourses are overall
......
......@@ -31,9 +31,14 @@ for s = 1:params.S
run = sprintf('R%02d',r);
runDir = fullfile(subjDir, 'Runs', run);
% Timecourses
A{s}{r} = h5read(fullfile(runDir, 'TimeCourses.post', ...
'CleanTimeCourses', 'Means.hdf5'), '/dataset');
%'Means.hdf5'), '/dataset');
% Modulate by amplitudes
h = h5read(fullfile(runDir, 'ComponentWeightings.post', ...
'Means.hdf5'), '/dataset');
A{s}{r} = A{s}{r} .* h;
% Temporal netmats
precmat = h5read(fullfile(runDir, 'TemporalPrecisionMatrix.post', ...
......
......@@ -165,8 +165,11 @@ modeOptions.P.registration.form = 'Null';
%Time courses
options.An.form = 'Freq';
%options.An.offRate = 0.05 * 1/params.N; % Useful, but not really with partial correlations...
options.An.offRate = 0.0;
% Amplitude variability
options.An.amp.a = 50.0;
options.An.amp.b = 50.0;
% Proportion of modes missing (per subject & mode)
options.An.offRate = 0.05 * 1/params.N; % 1/20 subjects has a missing mode
switch options.An.form
case 'Freq'
% Reducing these parameters will increase the
......
......@@ -85,7 +85,6 @@ end
%--------------------------------------------------------------------------
% Repeat for the temporal accuracy
% Take correlation between true and inferred time courses
scores.A.data = NaN(sum(params.R), params.N);
......@@ -107,6 +106,42 @@ end
%--------------------------------------------------------------------------
% Accuaracy of amplitudes
% Assemble all elements into a [n, sr] matrix
aA = NaN(params.N, sum(params.R)); inf_aA = NaN(params.N, sum(params.R));
sr = 1;
for s = 1:params.S
for r = 1:params.R(s)
aA(:,sr) = std(A{s}{r}(gt_inds,:)');
inf_aA(:,sr) = std(inf_A{s}{r}(inf_inds,:)');
sr = sr + 1;
end
end
% Save the correlations over amplitudes
% Each subject, across amplitudes (i.e. relative amplitudes similar)
% ** IGNORED ** Can't really disambiguate this from spatial scale
%scores.aA.data = diag(corr(aA, inf_aA));
% Return scores in order of GT components so comparable across methods
%scores.aA.data = scores.aA.data(gt_inds);
%scores.aA.name = 'Amplitudes';
%scores.aA.metric = 'Correlation';
%scores.aA.range = [-1.0, 1.0];
% Each element, across amplitudes (i.e. behavioural prediction)
scores.aA_xs.data = diag(corr(aA', inf_aA'));
scores.aA_xs.name = 'Amplitudes (cross subject)';
scores.aA_xs.metric = 'Correlation';
scores.aA_xs.range = [-1.0, 1.0];
%figure; imagesc(aA, max(aA(:))*[-1 1]); colorbar();
%figure; imagesc(inf_aA, max(inf_aA(:))*[-1 1]); colorbar();
%figure; imagesc(zscore(aA')'); colorbar();
%figure; imagesc(zscore(inf_aA')'); colorbar();
%--------------------------------------------------------------------------
%Now find how well the mode interactions have been calculated
%First for the spatial correlations
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment