Skip to content

Instantly share code, notes, and snippets.

@rainyear
Created December 14, 2013 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rainyear/7958534 to your computer and use it in GitHub Desktop.
Save rainyear/7958534 to your computer and use it in GitHub Desktop.
Using the Ci_up as the threshold, the diagnostic proportions ( >= Ci_up ) were replaced with 1 and the nondiagnostic proportions( < Ci_up ) were replaced with 0, and then I got a binary diagnosticPlane, and the antidiagnostiPlane were obtained by replacing the diagnostic proportions with 0, and nondiagnostic proportions with 1.
DEBUG = 1;
namePat = 'gender_backup-%d.mat';
numSubjects = 16;
nLevels = 5;
Ci_up = [0.6914 0.6855 0.6728 0.6404 0.6228]; % upper confidence internal for 5 scale
allProportion = zeros(256,256,5,numSubjects);
MeanProportion = zeros(256,256,5);
allDiagnostic = zeros(256,256,5);
allAntiDiagnostic = zeros(256,256,5);
tic
% compute the proportionPlane for each subject
for i = 1:numSubjects
if(DEBUG),display(sprintf('Extracting subject %d...\n', i));end
nameData = sprintf(namePat, i);
load(nameData, 'correctPlane','totalPlane');
for j = 1:nLevels
allProportion(:,:,j,i) = correctPlane(:,:,j) ./ totalPlane(:,:,j);
end
% break;
end
% compute the mean of proportionPlane for 16 subjects
for i = 1:nLevels
for j = 1:numSubjects
MeanProportion(:,:,i) = MeanProportion(:,:,i) + allProportion(:,:,i,j);
end
MeanProportion(:,:,i) = MeanProportion(:,:,i) ./numSubjects;
end
% compute the diagnosticPlane and antiDiagnosticPlane
for i = 1:nLevels
if(DEBUG),display(sprintf('TEST Level %d...\n', i));
end
for x = 1:256
for y = 1:256
if( MeanProportion(x,y,i) >= Ci_Up(1,i))
allDiagnostic(x,y,i) = 1;
allAntiDiagnostic(x,y,i) = 0;
else
allDiagnostic(x,y,i) = 0;
allAntiDiagnostic(x,y,i) = 1;
end
end
end
end
toc
clear correctPlane totalPlane;
save('allResults.mat', 'allProportion', 'MeanProportion','allDiagnostic', 'allAntiDiagnostic');
clear all;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment