0001 function cv_model = prt_cfg_cv_model
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 infile = cfg_files;
0013 infile.tag = 'infile';
0014 infile.name = 'Load PRT.mat';
0015 infile.filter = 'mat';
0016 infile.num = [1 1];
0017 infile.help = {'Select PRT.mat (file containing data/design structure).'};
0018
0019
0020
0021
0022 model_name = cfg_entry;
0023 model_name.tag = 'model_name';
0024 model_name.name = 'Model name';
0025 model_name.help = {'Name of a model. Must match your entry in the '...
0026 '''Specify model'' batch module.'};
0027 model_name.strtype = 's';
0028 model_name.num = [1 Inf];
0029
0030
0031
0032
0033 no_perm = cfg_const;
0034 no_perm.tag = 'no_perm';
0035 no_perm.name = 'No permutation test';
0036 no_perm.val = {1};
0037 no_perm.help = {'Do not perform permutation test'};
0038
0039
0040
0041
0042 N_perm = cfg_entry;
0043 N_perm.tag = 'N_perm';
0044 N_perm.name = 'Number of permutations';
0045 N_perm.help = {'Enter the number of permutations to perform'};
0046 N_perm.strtype = 'e';
0047 N_perm.val = {1000};
0048 N_perm.num = [1 1];
0049
0050
0051
0052
0053 flag_sw = cfg_menu;
0054 flag_sw.tag = 'flag_sw';
0055 flag_sw.name = 'Save permutations parameters';
0056 flag_sw.help = {['Set to Yes to save the parameterss obtained from each' ...
0057 'permutation.']};
0058 flag_sw.labels = {
0059 'Yes'
0060 'No'
0061 }';
0062 flag_sw.values = {1 0};
0063 flag_sw.val = {0};
0064
0065
0066
0067
0068 perm_t = cfg_branch;
0069 perm_t.tag = 'perm_t';
0070 perm_t.name = 'Permutation test';
0071 perm_t.val = {N_perm, flag_sw};
0072 perm_t.help = {'Perform a permutation test.'};
0073
0074
0075
0076
0077 perm_test = cfg_choice;
0078 perm_test.tag = 'perm_test';
0079 perm_test.name = 'Do permutation test?';
0080 perm_test.values = {no_perm, perm_t};
0081 perm_test.val = {no_perm};
0082 perm_test.help = {'Perform a permutation test on accuracy, or not'};
0083
0084
0085
0086
0087 cv_model = cfg_exbranch;
0088 cv_model.tag = 'cv_model';
0089 cv_model.name = 'Run model';
0090 cv_model.val = {infile model_name perm_test};
0091 cv_model.help = {...
0092 ['Trains and tests the predictive machine using the cross-validation ',...
0093 'structure specified by the model.']};
0094 cv_model.prog = @prt_run_cv_model;
0095 cv_model.vout = @vout_data;
0096
0097
0098
0099
0100 function cdep = vout_data(job)
0101
0102
0103 cdep(1) = cfg_dep;
0104 cdep(1).sname = 'PRT.mat file';
0105 cdep(1).src_output = substruct('.','files');
0106 cdep(1).tgt_spec = cfg_findspec({{'filter','mat','strtype','e'}});
0107