git.schokokeks.org
Repositories
Help
Report an Issue
SVMCrossVal.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
b8f957c
Branches
Tags
master
SVMCrossVal.git
classify.m
GUI parsing halfway done.
Christoph Budziszewski
commited
b8f957c
at 2008-12-17 17:57:53
classify.m
Blame
History
Raw
function classify(varargin) switch nargin case 0 action = 'decode'; SubjectID = 'JZ006'; case 1 action = 'decode'; paramModel = varargin{1}; otherwise error('spmtoolbox:SVMCrossVal:arginError','Please Specify action and parameter model'); end switch(action) case 'clear' evalin('base','clear map lm SPM classList dataTimeLine decodeTable labelTimeLine svmopts trialProtocol voxelList xTimeEnd xTimeStart xTimeWindow'); case 'decode' SubjectID = getSubjectIDString(paramModel); display('loading SPM.mat'); % SubjectID = 'JZ006'; % SubjectID = 'AI020'; % SubjectID = 'HG027'; spm = load(fullfile('D:\Analyze\Choice\24pilot',SubjectID,'results\SPM.mat')); display('done.'); params = struct; params.nClasses = 2; assignin('base','params',params); %% calculate display('calculating cross-validation performance time-shift'); calculateParams = struct; calculateParams.des = spm.SPM; calculateParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart); % -20; calculateParams.frameShiftEnd = getDouble(paramModel.txtFrameShiftEnd); %15; calculateParams.decodeDuration = getDouble(paramModel.txtFrameShiftDur); calculateParams.psthStart = getDouble(paramModel.txtPSTHStart); % -25; calculateParams.psthEnd = getDouble(paramModel.txtPSTHEnd); % 20; calculateParams.baselineStart = getDouble(paramModel.txtBaselineStart); % -22; calculateParams.baselineEnd = getDouble(paramModel.txtBaselineEnd); % -20; calculateParams.voxelList = parseVoxelList(paramModel); calculateParams.svmargs = get(paramModel.txtSVMopts,'String'); calculateParams.sessionList = 1:3; % parseClassDef(paramModel) calculateParams.classList = {'<','>'}; calculateParams.labelMap = LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); calculateParams.eventList = [9,11,13; 10,12,14]; assignin('base','calculateParams',calculateParams); % [decodeTable rawTimeCourse] = calculateDecodePerformance(spm,params.frameShiftStart,params.frameShiftEnd,params.xTimeWindow,params.svmopts,1:4,params.sessionList,params.voxelList,params.classList,params.labelMap,params.normalize); decode = calculateDecodePerformance(calculateParams); display(sprintf('Min CrossVal Accuracy: %g%% \t Max CrossVal Accuracy: %g%%',decode.minPerformance,decode.maxPerformance)); assignin('base','decode',decode); display('Finished calculations.'); display('Plotting.'); plotParams = struct; plotParams.psthStart = calculateParams.psthStart; plotParams.psthEnd = calculateParams.psthEnd; plotParams.nClasses = length(calculateParams.classList); plotParams.frameShiftStart = calculateParams.frameShiftStart; plotParams.frameShiftEnd = calculateParams.frameShiftEnd; plotParams.decodePerformance = decode.decodePerformance; plotParams.rawTimeCourse = decode.rawTimeCourse; plotParams.SubjectID = SubjectID; assignin('base','plotParams',plotParams); % plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse); plotDecodePerformance(plotParams); otherwise display('give action command: clear decode'); end end