git.schokokeks.org
Repositories
Help
Report an Issue
SVMCrossVal.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
38be2ad
Branches
Tags
master
SVMCrossVal.git
private
classify.m
moving things to private, some modifications
Christoph Budziszewski
commited
38be2ad
at 2009-01-16 02:48:58
classify.m
Blame
History
Raw
function classify(varargin) switch nargin case 1 paramModel = varargin{1}; %PROJECT_BASE_PATH = 'D:\Analyze\Stimolos'; PROJECT_BASE_PATH = 'D:\Analyze\Choice\24pilot'; PROJECT_RESULT_PATH = 'results\SPM.mat'; otherwise error('spmtoolbox:SVMCrossVal:arginError','Please Specify action and parameter model'); end % common params calculateParams = struct; calculateParams.smoothed = getDouble(paramModel.txtSmoothed); 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.svmargs = get(paramModel.txtSVMopts,'String'); calculateParams.sessionList = 1:3; classStruct = parseClassDef(paramModel); calculateParams.labelMap = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel calculateParams.classList = getClasses(calculateParams.labelMap); calculateParams.eventList = classStruct.eventMatrix; %[9,11,13; 10,12,14]; % calculateParams.eventList = getPSTEventMatrix(calculateParams.labelMap); subjectSelection = getSubjectIDString(paramModel); decode = struct; decode.decodePerformance = []; decode.rawTimeCourse = []; for subjectCell = subjectSelection SubjectID = cell2mat(subjectCell); namehelper = strcat('s',SubjectID); %Vars can not start with numbers. display('loading SPM.mat ...'); spm = load(fullfile(PROJECT_BASE_PATH,SubjectID,PROJECT_RESULT_PATH)); display('... done.'); %% calculate calculateParams.(namehelper).des = spm.SPM; calculateParams.(namehelper).voxelList = parseVoxelList(paramModel,SubjectID); assignin('base','calculateParams',calculateParams); display(sprintf('calculating cross-validation performance time-shift for Subject %s. Please Wait. ...',SubjectID)); display('switching off all warnings'); warning_state = warning('off','all'); display('calculating ...'); decode.(namehelper) = calculateDecodePerformance(calculateParams,SubjectID); display('... done'); display('restoring warnings'); warning(warning_state); decode.decodePerformance = [decode.decodePerformance decode.(namehelper).decodePerformance]; decode.rawTimeCourse = [decode.rawTimeCourse decode.(namehelper).rawTimeCourse]; assignin('base','decode',decode); end 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; if numel(subjectSelection) == 1 plotParams.SubjectID = SubjectID; else plotParams.SubjectID = 'Multiple'; end plotParams.smoothed = boolToYesNoString(calculateParams.smoothed); assignin('base','plotParams',plotParams); % plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse); plotDecodePerformance(plotParams); display('all done.'); end