Commit c8f81eb8 authored by Sam Harrison's avatar Sam Harrison
Browse files

Increase numerical stability of dual regression

parent ef8fb697
......@@ -4,9 +4,11 @@ function [ P, A ] = runDR( D, Pg, params )
nComps = size(Pg, 2);
iPg = pinv(Pg - mean(Pg,1));
% Remove any almost zero maps to keep things more computationally stable
Pg(:, std(Pg) < 1.0e-5 * max(std(Pg))) = 0.0;
% Regression for the time courses
iPg = pinv(Pg - mean(Pg,1));
A = cell(params.S,1);
for s = 1:params.S
A{s} = cell(params.R(s),1);
......
......@@ -16,7 +16,9 @@ cP = 0;
for s = 1:params.S
cP = cP + [P{s} inf_P{s}]' * [P{s} inf_P{s}];
end
%Normalise
cP = corrcov(cP);
%figure; imagesc(cP, [-1, 1]); colorbar
%Just the scores between the two
cP = cP( 1:params.N, params.N+(1:params.iN) );
......@@ -30,6 +32,7 @@ for s = 1:params.S
end
%Normalise
cA = corrcov(cA);
%figure; imagesc(cA, [-1, 1]); colorbar
%Just the scores between the two
cA = cA( 1:params.N, params.N+(1:params.iN) );
......
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