ea0c5c024698287e38acade4db227b74801d26ad
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

calculateDecodePerformance.m           1) % function [decodePerformance rawTimecourse ] = calculateDecodePerformance(des,timeLineStart, timeLineEnd, decodeDuration, svmargs, conditionList, sessionList, voxelList, classList, labelMap,normalize)
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m   2) function outputStruct = calculateDecodePerformance(timeline,inputStruct,subjectParams)
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

calculateDecodePerformance.m           3) 
Christoph Budziszewski using global variables now....

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m   4) global CROSSVAL_METHOD_DEF;
private/calculateDecodePerformance.m   5) 
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m   6) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

calculateDecodePerformance.m           7) addpath 'libsvm-mat-2.88-1';
calculateDecodePerformance.m           8) 
Christoph Budziszewski using global variables now....

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m   9) % CROSSVAL_METHOD_DEF = inputStruct.CROSSVAL_METHOD_DEF;
Christoph Budziszewski transport changes

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  10) METHOD              = inputStruct.CROSSVAL_METHOD;
Christoph Budziszewski transport changes

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  11) 
private/calculateDecodePerformance.m  12) RANDOMIZE_DATAPOINTS = inputStruct.RANDOMIZE;
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

calculateDecodePerformance.m          13) 
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  14) % SubjectID       = subjectParams.SubjectID;
private/calculateDecodePerformance.m  15) % namehelper      = subjectParams.namehelper;
private/calculateDecodePerformance.m  16) voxelList       = subjectParams.voxelList;
private/calculateDecodePerformance.m  17) des             = subjectParams.des;
private/calculateDecodePerformance.m  18) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

calculateDecodePerformance.m          19) outputStruct = struct;
calculateDecodePerformance.m          20) 
calculateDecodePerformance.m          21) svmargs         = inputStruct.svmargs;
calculateDecodePerformance.m          22) sessionList     = inputStruct.sessionList;
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  23) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

calculateDecodePerformance.m          24) % classList       = inputStruct.classList;
calculateDecodePerformance.m          25) % labelMap        = inputStruct.labelMap;
calculateDecodePerformance.m          26) eventList       = inputStruct.eventList;
calculateDecodePerformance.m          27) 
Christoph Budziszewski subject loop is function

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  28) timeLineStart   = timeline.frameShiftStart;
private/calculateDecodePerformance.m  29) timeLineEnd     = timeline.frameShiftEnd;
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  30) % decodeDuration  = timeline.decodeDuration;
private/calculateDecodePerformance.m  31) % globalStart     = timeline.psthStart;
private/calculateDecodePerformance.m  32) % globalEnd       = timeline.psthEnd;
private/calculateDecodePerformance.m  33) % baselineStart   = timeline.baselineStart;
private/calculateDecodePerformance.m  34) % baselineEnd     = timeline.baselineEnd;
Christoph Budziszewski subject loop is function

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  35) 
private/calculateDecodePerformance.m  36) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

calculateDecodePerformance.m          37) minPerformance = inf;
calculateDecodePerformance.m          38) maxPerformance = -inf;
Christoph Budziszewski added 2nd classification me...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  39) 
Christoph Budziszewski new parseVoxelTxtField getI...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  40) subjectDir = '';
private/calculateDecodePerformance.m  41) sessionDirList = sessionList2DirList(sessionList) ;
private/calculateDecodePerformance.m  42) mask = '^fandersen.*img$';
private/calculateDecodePerformance.m  43) imageFiles = getImageFileList(subjectDir,sessionDirList,mask);
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  44) 
private/calculateDecodePerformance.m  45) 
Christoph Budziszewski new parseVoxelTxtField getI...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  46) disp('press key');
private/calculateDecodePerformance.m  47) pause
private/calculateDecodePerformance.m  48) 
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  49) extr = calculateImageData(imageFiles,voxelList);
private/calculateDecodePerformance.m  50) 
private/calculateDecodePerformance.m  51) nVoxel = size(voxelList,1);
private/calculateDecodePerformance.m  52) 
private/calculateDecodePerformance.m  53) calculatePstOpts = struct;
private/calculateDecodePerformance.m  54) calculatePstOpts.des = des;
private/calculateDecodePerformance.m  55) calculatePstOpts.eventList = eventList;
private/calculateDecodePerformance.m  56) calculatePstOpts.sessionList = sessionList;
private/calculateDecodePerformance.m  57) 
private/calculateDecodePerformance.m  58) for iVoxel = 1:nVoxel
Christoph Budziszewski git-svn-id: https://svn.dis...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  59)     rawdata = [];
private/calculateDecodePerformance.m  60)     for iImage = 1:length(extr);
private/calculateDecodePerformance.m  61)         tmp = extr(iImage);
private/calculateDecodePerformance.m  62)         rawdata = [rawdata tmp.dat(iVoxel)];
private/calculateDecodePerformance.m  63)     end
private/calculateDecodePerformance.m  64)     pst{iVoxel} = calculatePST(timeline,calculatePstOpts,rawdata);
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m  65) end
private/calculateDecodePerformance.m  66) 
private/calculateDecodePerformance.m  67) %         for voxel = 1:size(voxelList,1)  % [[x;x],[y;y],[z;z]]
private/calculateDecodePerformance.m  68) %             extr        = calculateImageData(imageFiles,voxelList(voxel,:));
private/calculateDecodePerformance.m  69) %             rawdata     = cell2mat({extr.mean}); % Raw Data
private/calculateDecodePerformance.m  70) %             pst{voxel}  = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,eventList,rawdata,sessionList);
private/calculateDecodePerformance.m  71) %         end
private/calculateDecodePerformance.m  72) 
private/calculateDecodePerformance.m  73) timePointArgs.pst = pst;
private/calculateDecodePerformance.m  74) 
private/calculateDecodePerformance.m  75) timePointArgs.labelMap      = inputStruct.labelMap;
private/calculateDecodePerformance.m  76) timePointArgs.eventList     = eventList;
private/calculateDecodePerformance.m  77) 
private/calculateDecodePerformance.m  78) timePointMatrix = buildTimePointMatrix(timeline,timePointArgs);
private/calculateDecodePerformance.m  79) 
private/calculateDecodePerformance.m  80) decodePerformance = [];
private/calculateDecodePerformance.m  81) for index = 1:timeLineEnd-timeLineStart+1
private/calculateDecodePerformance.m  82) 
private/calculateDecodePerformance.m  83)     svmdata      = timePointMatrix{index}(:,2:size(timePointMatrix{index},2));
private/calculateDecodePerformance.m  84)     svmlabel     = timePointMatrix{index}(:,1);
private/calculateDecodePerformance.m  85) 
private/calculateDecodePerformance.m  86)     if RANDOMIZE_DATAPOINTS
private/calculateDecodePerformance.m  87)         rndindex  = randperm(length(svmlabel));
private/calculateDecodePerformance.m  88)         svmdata   = svmdata(rndindex,:);
private/calculateDecodePerformance.m  89)         svmlabel  = svmlabel(rndindex);
private/calculateDecodePerformance.m  90)     end
private/calculateDecodePerformance.m  91) 
private/calculateDecodePerformance.m  92)     switch METHOD;
private/calculateDecodePerformance.m  93)         case CROSSVAL_METHOD_DEF.svmcrossval
private/calculateDecodePerformance.m  94) 
private/calculateDecodePerformance.m  95)             performance  = svmtrain(svmlabel, svmdata, svmargs);
private/calculateDecodePerformance.m  96) 
private/calculateDecodePerformance.m  97)             minPerformance = min(minPerformance,performance);
private/calculateDecodePerformance.m  98)             maxPerformance = max(maxPerformance,performance);
private/calculateDecodePerformance.m  99) 
private/calculateDecodePerformance.m 100)             decodePerformance = [decodePerformance; performance];
private/calculateDecodePerformance.m 101) 
private/calculateDecodePerformance.m 102)         case CROSSVAL_METHOD_DEF.classPerformance
private/calculateDecodePerformance.m 103) 
private/calculateDecodePerformance.m 104)             newsvmopt = killCrossvalOpt(svmargs);
private/calculateDecodePerformance.m 105) 
private/calculateDecodePerformance.m 106)             model = svmtrain(svmlabel,svmdata,newsvmopt);
private/calculateDecodePerformance.m 107)             classperformance = [];
private/calculateDecodePerformance.m 108)             for class = unique(svmlabel)';
private/calculateDecodePerformance.m 109) 
private/calculateDecodePerformance.m 110)                 filterindex = find(class == svmlabel);
private/calculateDecodePerformance.m 111)                 testing_label = svmlabel(filterindex);
private/calculateDecodePerformance.m 112)                 testing_data  = svmdata(filterindex);
private/calculateDecodePerformance.m 113)                 [plabel accuracy dvalue] = svmpredict(testing_label,testing_data,model,'');
private/calculateDecodePerformance.m 114) 
private/calculateDecodePerformance.m 115)                 classperformance = [classperformance accuracy(1)];
Christoph Budziszewski kleine änderungen code move

Christoph Budziszewski authored 15 years ago

calculateDecodePerformance.m         116)             end
Christoph Budziszewski refactored to arg-structs!...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m 117)             decodePerformance = [decodePerformance; classperformance];
private/calculateDecodePerformance.m 118) 
private/calculateDecodePerformance.m 119)         case CROSSVAL_METHOD_DEF.somTraining
private/calculateDecodePerformance.m 120) 
private/calculateDecodePerformance.m 121)             display('SOM TRAINING');
private/calculateDecodePerformance.m 122)             addpath 'somtoolbox2';
private/calculateDecodePerformance.m 123)             sD = som_data_struct(svmdata,'label',num2str(svmlabel));
private/calculateDecodePerformance.m 124)             assignin('base','sD',sD);
private/calculateDecodePerformance.m 125)             sM = som_make(sD,'msize', [3 3],'lattice', 'hexa');
private/calculateDecodePerformance.m 126) 
private/calculateDecodePerformance.m 127)             assignin('base','sD',sD);
private/calculateDecodePerformance.m 128)             assignin('base','sM',sM);
private/calculateDecodePerformance.m 129)             display('type ''figure'' before visualisation');
private/calculateDecodePerformance.m 130)     end
private/calculateDecodePerformance.m 131) 
private/calculateDecodePerformance.m 132) end
private/calculateDecodePerformance.m 133) 
private/calculateDecodePerformance.m 134) outputStruct.decodePerformance  = decodePerformance;
private/calculateDecodePerformance.m 135) outputStruct.svmdata            = svmdata;
private/calculateDecodePerformance.m 136) outputStruct.svmlabel           = svmlabel;
private/calculateDecodePerformance.m 137) outputStruct.rawTimeCourse      = pst;
private/calculateDecodePerformance.m 138) outputStruct.minPerformance     = minPerformance;
private/calculateDecodePerformance.m 139) outputStruct.maxPerformance     = maxPerformance;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

calculateDecodePerformance.m         140) end
calculateDecodePerformance.m         141) 
Christoph Budziszewski added 2nd classification me...

Christoph Budziszewski authored 15 years ago

private/calculateDecodePerformance.m 142) function opts = killCrossvalOpt(svmopt)
private/calculateDecodePerformance.m 143) opts = '';
private/calculateDecodePerformance.m 144) idx1 = 1;
private/calculateDecodePerformance.m 145) for idx2=strfind(svmopt,' -')
private/calculateDecodePerformance.m 146)     if idx1 ~= strfind(svmopt,' -v')
private/calculateDecodePerformance.m 147)         opts = strcat(opts,svmopt(idx1:idx2));
private/calculateDecodePerformance.m 148)     end
private/calculateDecodePerformance.m 149)     idx1=idx2;
private/calculateDecodePerformance.m 150)     if idx2==max(strfind(svmopt,' -'))
private/calculateDecodePerformance.m 151)         opts = strcat(opts,svmopt(idx2:end));
private/calculateDecodePerformance.m 152)     end
private/calculateDecodePerformance.m 153) end
private/calculateDecodePerformance.m 154) end
private/calculateDecodePerformance.m 155)