Home > batch > prt_run_cv_model.m

prt_run_cv_model

PURPOSE ^

SYNOPSIS ^

function out = prt_run_cv_model(varargin)

DESCRIPTION ^

 PRONTO job execution function

 INPUT
   job    - harvested job data structure (see matlabbatch help)

 OUTPUT
   out    - filename of saved data structure (1 file per group, per 
            subject, per modality, per condition 
__________________________________________________________________________
 Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function out = prt_run_cv_model(varargin)
0002 %
0003 % PRONTO job execution function
0004 %
0005 % INPUT
0006 %   job    - harvested job data structure (see matlabbatch help)
0007 %
0008 % OUTPUT
0009 %   out    - filename of saved data structure (1 file per group, per
0010 %            subject, per modality, per condition
0011 %__________________________________________________________________________
0012 % Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory
0013 
0014 % Written by A Marquand
0015 % $Id$
0016 
0017 job   = varargin{1};
0018 
0019 % Load PRT.mat
0020 % -------------------------------------------------------------------------
0021 fname = char(job.infile);
0022 if exist('PRT','var')
0023     clear PRT
0024 end
0025 load(fname);
0026 
0027 % -------------------------------------------------------------------------
0028 % Input file
0029 % -------------------------------------------------------------------------
0030 
0031 in.fname      = job.infile;
0032 in.model_name = job.model_name;
0033 mid = prt_init_model(PRT, in);
0034 
0035 % Special cross-validation for MCKR
0036 if strcmp(PRT.model(mid).input.machine.function,'prt_machine_mckr')
0037     fname = prt_cv_mckr(PRT,in);
0038 else
0039     fname = prt_cv_model(PRT, in);
0040 end
0041 
0042 % Permutation test, required.
0043 load(fname) % reload updated PRT!
0044 if isfield(job,'perm_test') % to ensure back compatibility with older batch
0045     if isfield(job.perm_test,'perm_t')
0046         if isfield(job.perm_test.perm_t,'flag_sw') %keep compatibility
0047             flag = job.perm_test.perm_t.flag_sw;
0048         else
0049             flag = 0;
0050         end
0051         prt_permutation(PRT, job.perm_test.perm_t.N_perm, mid, ...
0052             spm_str_manip(fname,'h'),flag);
0053     end
0054 end
0055 
0056 % -------------------------------------------------------------------------
0057 % Function output
0058 % -------------------------------------------------------------------------
0059 out = []; %prevent warning of overwriting 'char' class
0060 disp('Model execution complete.')
0061 out.files{1} = in.fname{1};
0062 disp('Done')
0063 
0064  return

Generated on Tue 10-Feb-2015 18:16:33 by m2html © 2005