Home > batch > prt_cfg_model.m

prt_cfg_model

PURPOSE ^

Data & design configuration file

SYNOPSIS ^

function model = prt_cfg_model

DESCRIPTION ^

 Data & design configuration file
 This configures the kernel construction for each modality.
_______________________________________________________________________
 Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function model = prt_cfg_model
0002 % Data & design configuration file
0003 % This configures the kernel construction for each modality.
0004 %_______________________________________________________________________
0005 % Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory
0006 
0007 % Written by Andre Marquand
0008 % $Id$
0009 
0010 def = prt_get_defaults;
0011 
0012 % ---------------------------------------------------------------------
0013 % filename Filename(s) of data
0014 % ---------------------------------------------------------------------
0015 infile        = cfg_files;
0016 infile.tag    = 'infile';
0017 infile.name   = 'Load PRT.mat';
0018 infile.ufilter = 'PRT.mat';
0019 infile.num    = [1 1];
0020 infile.help   = {'Select data/design structure file (PRT.mat).'};
0021 
0022 % ---------------------------------------------------------------------
0023 % model_name Name
0024 % ---------------------------------------------------------------------
0025 model_name         = cfg_entry;
0026 model_name.tag     = 'model_name';
0027 model_name.name    = 'Model name';
0028 model_name.help    = {'Name for model'};
0029 model_name.strtype = 's';
0030 model_name.num     = [1 Inf];
0031  
0032 % ---------------------------------------------------------------------
0033 % use_kernel Use Kernels
0034 % ---------------------------------------------------------------------
0035 use_kernel         = cfg_menu;
0036 use_kernel.tag     = 'use_kernel';
0037 use_kernel.name    = 'Use kernels';
0038 use_kernel.help    = {...
0039     ['Are the data for this model in the form of kernels/basis functions? ', ...
0040      'If ''No'' is selected, it is assumed the data are in the form of ',...
0041      'feature matrices']};
0042 use_kernel.labels  = {
0043                'Yes'
0044                'No'
0045 }';
0046 use_kernel.values  = {1 0};
0047 use_kernel.val     = {1};
0048 
0049 % ---------------------------------------------------------------------
0050 % all_features All features
0051 % ---------------------------------------------------------------------
0052 all_features         = cfg_const;
0053 all_features.tag     = 'all_features';
0054 all_features.name    = 'All Features';
0055 all_features.val     = {1};
0056 all_features.help    = {...
0057     'Include all features from all modalities in this feature set'};
0058 
0059 % ---------------------------------------------------------------------
0060 % fs_name Feature set name
0061 % ---------------------------------------------------------------------
0062 fs_name         = cfg_entry;
0063 fs_name.tag     = 'fs_name';
0064 fs_name.name    = 'Name';
0065 fs_name.help    = {'Name of a feature set. Must match design specification'};
0066 fs_name.strtype = 's';
0067 fs_name.num     = [1 Inf];
0068 
0069 % ---------------------------------------------------------------------
0070 % mod_name Modality name
0071 % ---------------------------------------------------------------------
0072 mod_name         = cfg_entry;
0073 mod_name.tag     = 'mod_name';
0074 mod_name.name    = 'Modality name';
0075 mod_name.help    = {'Name of modality. Example: ''BOLD''. Must match design specification'};
0076 mod_name.strtype = 's';
0077 mod_name.num     = [1 Inf];
0078 
0079 % ---------------------------------------------------------------------
0080 % fset Feature set
0081 % ---------------------------------------------------------------------
0082 % fset         = cfg_branch;
0083 % fset.tag     = 'fset';
0084 % fset.name    = 'Feature set';
0085 % fset.help    = {'Feature set to include in this model'};
0086 % fset.val     = {fs_name};
0087             
0088 % ---------------------------------------------------------------------
0089 % fsets Feature sets
0090 % ---------------------------------------------------------------------
0091 fsets         = cfg_entry;
0092 fsets.tag     = 'fsets';
0093 fsets.name    = 'Feature sets';
0094 fsets.help    = {['Enter the name of a feature set to include in this model. ',...
0095                   'This can be kernel or a feature matrix. ', ...
0096                   ]};
0097 fsets.num     = [1 Inf];
0098 %fsets.values  = {fsets};
0099 fsets.strtype  = 's';
0100 
0101 % ---------------------------------------------------------------------
0102 % gr_name Group name
0103 % ---------------------------------------------------------------------
0104 gr_name         = cfg_entry;
0105 gr_name.tag     = 'gr_name';
0106 gr_name.name    = 'Group name';
0107 gr_name.help    = {'Name of the group to include. Must exist in PRT.mat'};
0108 gr_name.strtype = 's';
0109 gr_name.num     = [1 Inf];
0110 
0111 % ---------------------------------------------------------------------
0112 % all_cond All conditions
0113 % ---------------------------------------------------------------------
0114 all_cond         = cfg_const;
0115 all_cond.tag     = 'all_cond';
0116 all_cond.name    = 'All Conditions';
0117 all_cond.val     = {1};
0118 all_cond.help    = {'Include all conditions in this model'};
0119 
0120 % ---------------------------------------------------------------------
0121 % cond_name Condition name
0122 % ---------------------------------------------------------------------
0123 cond_name         = cfg_entry;
0124 cond_name.tag     = 'cond_name';
0125 cond_name.name    = 'Name';
0126 cond_name.help    = {'Name of condition to include.'};
0127 cond_name.strtype = 's';
0128 cond_name.num     = [1 Inf];
0129 
0130 % ---------------------------------------------------------------------
0131 % conds Conditions
0132 % ---------------------------------------------------------------------
0133 conds         = cfg_branch;
0134 conds.tag     = 'conds';
0135 conds.name    = 'Condition';
0136 conds.help    = {'Specify condition:.'};
0137 conds.val     = {cond_name};
0138 
0139 % ---------------------------------------------------------------------
0140 % sel_cond Select conditions
0141 % ---------------------------------------------------------------------
0142 sel_cond         = cfg_repeat;
0143 sel_cond.tag     = 'sel_cond';
0144 sel_cond.name    = 'Specify Conditions';
0145 sel_cond.help    = {'Specify the name of conditions to be included '};
0146 sel_cond.values  = {conds};
0147 
0148 % ---------------------------------------------------------------------
0149 % all_scans All scans
0150 % ---------------------------------------------------------------------
0151 all_scans         = cfg_const;
0152 all_scans.tag     = 'all_scans';
0153 all_scans.name    = 'All scans';
0154 all_scans.val     = {1};
0155 all_scans.help    = {['No design specified. This option can be used '...
0156     'for modalities (e.g. structural scans) that do not '...
0157     'have an experimental design or for an fMRI design',...
0158     'where you want to include all scans in the timeseries']};
0159 
0160 % ---------------------------------------------------------------------
0161 % conditions Conditions
0162 % ---------------------------------------------------------------------
0163 conditions        = cfg_choice;
0164 conditions.tag    = 'conditions';
0165 conditions.name   = 'Conditions / Scans';
0166 conditions.values = {sel_cond, all_cond, all_scans};
0167 conditions.help   = {...
0168     ['Which task conditions do you want to include? '...
0169     'Select conditions: select specific conditions from the timeseries. ', ...
0170     'All conditions: include all conditions extracted from the timeseries. ', ...
0171     'All scans: include all scans for each subject. This may be used for ', ...
0172     'modalities with only one scan per subject (e.g. PET), ', ...
0173     'if you want to include all scans from an fMRI timeseries (assumes you ',...
0174     'have not already detrended the timeseries and extracted task components)']};
0175 
0176 % ---------------------------------------------------------------------
0177 % modality Modality
0178 % ---------------------------------------------------------------------
0179 % modality      = cfg_branch;
0180 % modality.tag  = 'modality';
0181 % modality.name = 'Modality';
0182 % modality.val  = {mod_name conditions};
0183 % modality.help = {'Specify modality, such as name and data.'};
0184 
0185 % ---------------------------------------------------------------------
0186 % modalities Modalities
0187 % ---------------------------------------------------------------------
0188 % modalities         = cfg_repeat;
0189 % modalities.tag     = 'modalities';
0190 % modalities.name    = 'Modalities';
0191 % modalities.help    = {...
0192 %     ['Add modalities. Note that if multiple modalities are entered here, ',...
0193 %      'they will be added to the feature set as additional samples. ',...
0194 %      'In other words, modalities are concatenated along the sample ',...
0195 %      'dimension, not the feature dimension. For example, this is ',...
0196 %      'appropriate for accommodating multiple fMRI runs from identical ',...
0197 %      'subjects.']};
0198 % modalities.num     = [1 Inf];
0199 % modalities.values  = {modality};
0200 
0201 % ---------------------------------------------------------------------
0202 % subj_num Subjects selected (per group)
0203 % ---------------------------------------------------------------------
0204 subj_nums         = cfg_entry;
0205 subj_nums.tag     = 'subj_nums';
0206 subj_nums.name    = 'Subjects';
0207 subj_nums.help    = {
0208     ['Subject numbers to be included in this class. Note that individual ',...
0209      'numbers (e.g. 1), or a range of numbers ',...
0210      '(e.g. 3:5) can be entered'] };
0211 subj_nums.strtype = 'e';
0212 subj_nums.num     = [Inf 1];
0213 
0214 % ---------------------------------------------------------------------
0215 % group Group
0216 % ---------------------------------------------------------------------
0217 group         = cfg_branch;
0218 group.tag     = 'group';
0219 group.name    = 'Group';
0220 group.help    = {'Specify data and design for the group.'};
0221 group.val     = {gr_name, subj_nums, conditions};
0222 
0223 % ---------------------------------------------------------------------
0224 % class_name Class name
0225 % ---------------------------------------------------------------------
0226 class_name         = cfg_entry;
0227 class_name.tag     = 'class_name';
0228 class_name.name    = 'Name';
0229 class_name.help    = {'Name for this class, e.g. ''controls'' '};
0230 class_name.strtype = 's';
0231 class_name.num     = [1 Inf];
0232 
0233 % ---------------------------------------------------------------------
0234 % groups Groups
0235 % ---------------------------------------------------------------------
0236 groups         = cfg_repeat;
0237 groups.tag     = 'groups';
0238 groups.name    = 'Groups';
0239 groups.help    = {['Add one group to this class. Click ''new'' '...
0240                     'or ''repeat'' to add another group.']};
0241 groups.num     = [1 Inf];
0242 groups.values  = {group};
0243 
0244 % ---------------------------------------------------------------------
0245 % class Class
0246 % ---------------------------------------------------------------------
0247 class         = cfg_branch;
0248 class.tag     = 'class';
0249 class.name    = 'Class';
0250 class.help    = {...
0251     ['Specify which groups, modalities, subjects and conditions should ',...
0252      'be included in this class']};
0253 class.val     = {class_name, groups};
0254 
0255 % ---------------------------------------------------------------------
0256 % reg_targets Regression Targets
0257 % ---------------------------------------------------------------------
0258 reg_targets         = cfg_entry;
0259 reg_targets.tag     = 'reg_targets';
0260 reg_targets.name    = 'Regression targets';
0261 reg_targets.help    = {['Specify continuous valued target variables']};
0262 reg_targets.strtype = 'e';
0263 reg_targets.num     = [Inf 1];
0264 
0265 % % ---------------------------------------------------------------------
0266 % % mod_name Modality name
0267 % % ---------------------------------------------------------------------
0268 % mod_name2         = cfg_entry;
0269 % mod_name2.tag     = 'mod_name2';
0270 % mod_name2.name    = 'Modality name';
0271 % mod_name2.help    = {'Name of modality. We only allow one modality for regression model per group at this moment' ...
0272 %     'Example: ''BOLD''. Must match design specification'};
0273 % mod_name2.strtype = 's';
0274 % mod_name2.num     = [1 Inf];
0275 
0276 % ---------------------------------------------------------------------
0277 % reg_group Regression group
0278 % ---------------------------------------------------------------------
0279 reg_group         = cfg_branch;
0280 reg_group.tag     = 'reg_group';
0281 reg_group.name    = 'Group';
0282 reg_group.help    = {'Specify data and design for the group.'};
0283 %reg_group.val     = {gr_name, subj_nums, conditions, reg_targets};
0284 %reg_group.val     = {gr_name, subj_nums,mod_name2 };
0285 reg_group.val     = {gr_name, subj_nums};
0286 
0287 % ---------------------------------------------------------------------
0288 % k_args Define k for partioning
0289 % ---------------------------------------------------------------------
0290 k_args         = cfg_entry;
0291 k_args.tag     = 'k_args';
0292 k_args.name    = 'k';
0293 k_args.help    = {['Number of folds/partitions for CV. To create a 50%-50%,' ...
0294     'choose k as 2. Please note that there can be more partitions than'...
0295     ' specified when leaving subjects per group out. Also note that '...
0296     'leaving more than 50% of the data out is not permitted.']};
0297 k_args.strtype = 'e';
0298 k_args.num     = [1 1];
0299 
0300 % ---------------------------------------------------------------------
0301 % cv_loso Leave-one-subject-out
0302 % ---------------------------------------------------------------------
0303 cv_loso         = cfg_const;
0304 cv_loso.tag     = 'cv_loso';
0305 cv_loso.name    = 'Leave one subject out';
0306 cv_loso.val     = {1};
0307 cv_loso.help    = {'Leave a single subject out each cross-validation iteration'};
0308 
0309 % ---------------------------------------------------------------------
0310 % cv_lkso K-folds CV on Subjects
0311 % ---------------------------------------------------------------------
0312 cv_lkso         = cfg_branch;
0313 cv_lkso.tag     = 'cv_lkso';
0314 cv_lkso.name    = 'k-folds CV on subjects';
0315 cv_lkso.val     = {k_args};
0316 cv_lkso.help    = {'k-partitioning of subjects at each cross-validation iteration'};
0317 
0318 % ---------------------------------------------------------------------
0319 % cv_losgo Leave-one-subject-per-group-out
0320 % ---------------------------------------------------------------------
0321 cv_losgo         = cfg_const;
0322 cv_losgo.tag     = 'cv_losgo';
0323 cv_losgo.name    = 'Leave one subject per group out';
0324 cv_losgo.val     = {1};
0325 cv_losgo.help    = {...
0326     ['Leave out a single subject from each group at a time. ', ...
0327      'Appropriate for repeated measures or paired samples designs.']};
0328  
0329 % ---------------------------------------------------------------------
0330 % cv_lksgo K_folds CV on Subjects per Group
0331 % ---------------------------------------------------------------------
0332 cv_lksgo         = cfg_branch;
0333 cv_lksgo.tag     = 'cv_lksgo';
0334 cv_lksgo.name    = 'k-folds CV on subjects per group';
0335 cv_lksgo.val     = {k_args};
0336 cv_lksgo.help    = {...
0337     ['K-partitioning of subjects from each group at a time. ', ...
0338      'Appropriate for repeated measures or paired samples designs.']};
0339  
0340 % ---------------------------------------------------------------------
0341 % cv_lobo Leave-one-block-out
0342 % ---------------------------------------------------------------------
0343 cv_lobo         = cfg_const;
0344 cv_lobo.tag     = 'cv_lobo';
0345 cv_lobo.name    = 'Leave one block out';
0346 cv_lobo.val     = {1};
0347 cv_lobo.help    = {...
0348     ['Leave out a single block or event from each subject each iteration. ', ...
0349      'Appropriate for single subject designs.']};
0350 
0351 % ---------------------------------------------------------------------
0352 % cv_lkbo K-fold CV on blocks
0353 % ---------------------------------------------------------------------
0354 cv_lkbo         = cfg_branch;
0355 cv_lkbo.tag     = 'cv_lkbo';
0356 cv_lkbo.name    = 'k-folds CV on blocks';
0357 cv_lkbo.val     = {k_args};
0358 cv_lkbo.help    = {...
0359     ['k-partitioning on blocks or events from each subject each iteration. ', ...
0360      'Appropriate for single subject designs.']};
0361  
0362 % ---------------------------------------------------------------------
0363 % cv_loro Leave--one-run-per-subject-out (leave one modality out per
0364 % subject)
0365 % ---------------------------------------------------------------------
0366 cv_loro         = cfg_const;
0367 cv_loro.tag     = 'cv_loro';
0368 cv_loro.name    = 'Leave one run/session out';
0369 cv_loro.val     = {1};
0370 cv_loro.help    = {...
0371     ['Leave out a single run (modality) from each subject each iteration. ', ...
0372      'Appropriate for single subject designs with multiple runs/sessions.']};
0373    
0374 % ---------------------------------------------------------------------
0375 % cv_custom Feature set mask
0376 % ---------------------------------------------------------------------
0377 cv_custom        = cfg_files;
0378 cv_custom.tag    = 'cv_custom';
0379 cv_custom.name   = 'Custom';
0380 cv_custom.filter = 'mat';
0381 cv_custom.ufilter = '.*';
0382 cv_custom.num    = [1 1];
0383 cv_custom.help   = {...
0384     'Load a cross-validation matrix comprising a CV variable'};
0385 
0386 % ---------------------------------------------------------------------
0387 % cv_type Cross-validation type
0388 % ---------------------------------------------------------------------
0389 cv_type        = cfg_choice;
0390 cv_type.tag    = 'cv_type';
0391 cv_type.name   = 'Cross-validation type';
0392 cv_type.values = {cv_loso, cv_lkso, cv_losgo,cv_lksgo, cv_lobo,...
0393     cv_lkbo, cv_loro, cv_custom};
0394 cv_type.val    = {cv_loso};
0395 cv_type.help   = {'Choose the type of cross-validation to be used'};
0396 
0397 % ---------------------------------------------------------------------
0398 % machine_func Filename(s) of data
0399 % ---------------------------------------------------------------------
0400 machine_func        = cfg_files;
0401 machine_func.tag    = 'machine_func';
0402 machine_func.name   = 'Function';
0403 machine_func.ufilter = '^*.m';
0404 machine_func.num    = [1 1];
0405 machine_func.help   = {'Choose a function that will perform prediction.'};
0406 
0407 % ---------------------------------------------------------------------
0408 % machine_args Regression Targets
0409 % ---------------------------------------------------------------------
0410 machine_args         = cfg_entry;
0411 machine_args.tag     = 'machine_args';
0412 machine_args.name    = 'Arguments';
0413 machine_args.help    = {['Arguments for prediction machine.']};
0414 machine_args.strtype = 's';
0415 machine_args.num     = [1 Inf];
0416 
0417 % ---------------------------------------------------------------------
0418 % custom_machine Regression group
0419 % ---------------------------------------------------------------------
0420 custom_machine         = cfg_branch;
0421 custom_machine.tag     = 'custom_machine';
0422 custom_machine.name    = 'Custom machine';
0423 custom_machine.help    = {'Choose another prediction machine'};
0424 custom_machine.val     = {machine_func, machine_args};
0425 
0426 % ---------------------------------------------------------------------
0427 % svm_opt SVM : flag whether to optimize C
0428 % ---------------------------------------------------------------------
0429 svm_opt         = cfg_menu;
0430 svm_opt.tag     = 'svm_opt';
0431 svm_opt.name    = 'Optimize hyper-parameter';
0432 svm_opt.help    = {['Whether to optimize C, the SVM hyper-parameter, or not. '...
0433     'If Yes, than provide a range of possible values for C, in the form '...
0434     'min:step:max. Examples: 10.^[-2:5] or 1:100:1000 or 0.01 0.1 1 10 100. ' ...
0435     'If not, a default value will be used (C=1).']};
0436 svm_opt.labels  = {
0437     'No'
0438     'Yes'
0439     }';
0440 svm_opt.values  = {0 1};
0441 svm_opt.val     = {0};
0442 
0443 % ---------------------------------------------------------------------
0444 % svm_args Regression Targets
0445 % ---------------------------------------------------------------------
0446 svm_args         = cfg_entry;
0447 svm_args.tag     = 'svm_args';
0448 svm_args.name    = 'Soft-margin hyper-parameter';
0449 svm_args.help    = {['Value(s) for prt_machine_svm_bin: soft-margin C. ',...
0450     'Examples: 10.^[-2:5] or 1:100:1000 or 0.01 0.1 1 10 100.']};
0451 svm_args.strtype = 'e';
0452 svm_args.val     = {def.model.svmargs};
0453 svm_args.num     = [1 Inf];
0454 
0455 % ---------------------------------------------------------------------
0456 % cv_type Cross-validation type
0457 % ---------------------------------------------------------------------
0458 svm_cv_type_nested        = cfg_choice;
0459 svm_cv_type_nested.tag    = 'cv_type_nested';
0460 svm_cv_type_nested.name   = 'Cross-validation type for hyper-parameter optimization';
0461 svm_cv_type_nested.values = {cv_loso,cv_lkso, cv_losgo,cv_lksgo, cv_lobo,...
0462     cv_lkbo, cv_loro};
0463 svm_cv_type_nested.val    = {cv_loso};
0464 svm_cv_type_nested.help   = {'Choose the type of cross-validation to be used'};
0465 
0466 % ---------------------------------------------------------------------
0467 % svm group
0468 % ---------------------------------------------------------------------
0469 svm         = cfg_branch;
0470 svm.tag     = 'svm';
0471 svm.name    = 'SVM Classification';
0472 svm.help    = {'Binary support vector machine.'};
0473 svm.val     = {svm_opt, svm_args, svm_cv_type_nested};
0474 
0475 % ---------------------------------------------------------------------
0476 % gpc_args GPC arguments
0477 % ---------------------------------------------------------------------
0478 gpc_args         = cfg_entry;
0479 gpc_args.tag     = 'gpc_args';
0480 gpc_args.name    = 'Arguments';
0481 gpc_args.help    = {['Arguments for prt_machine_gpml']};
0482 gpc_args.strtype = 's';
0483 gpc_args.val     = {def.model.gpcargs};
0484 gpc_args.num     = [1 Inf];
0485 
0486 % ---------------------------------------------------------------------
0487 % gpc GPC
0488 % ---------------------------------------------------------------------
0489 gpc         = cfg_branch;
0490 gpc.tag     = 'gpc';
0491 gpc.name    = 'Gaussian Process Classification';
0492 gpc.help    = {'Gaussian Process Classification'};
0493 gpc.val     = {gpc_args};
0494 
0495 % ---------------------------------------------------------------------
0496 % gpclap_args GPC arguments
0497 % ---------------------------------------------------------------------
0498 gpclap_args         = cfg_entry;
0499 gpclap_args.tag     = 'gpclap_args';
0500 gpclap_args.name    = 'Arguments';
0501 gpclap_args.help    = {['Arguments for prt_machine_gpclap']};
0502 gpclap_args.strtype = 's';
0503 gpclap_args.val     = {def.model.gpclapargs};
0504 gpclap_args.num     = [1 Inf];
0505 
0506 % ---------------------------------------------------------------------
0507 % gpclap GPC
0508 % ---------------------------------------------------------------------
0509 gpclap         = cfg_branch;
0510 gpclap.tag     = 'gpclap';
0511 gpclap.name    = 'Multiclass GPC';
0512 gpclap.help    = {'Multiclass GPC'};
0513 gpclap.val     = {gpclap_args};
0514 
0515 % ---------------------------------------------------------------------
0516 % sMKL_cla_opt L1-MKL : flag whether to optimize C
0517 % ---------------------------------------------------------------------
0518 sMKL_cla_opt         = cfg_menu;
0519 sMKL_cla_opt.tag     = 'sMKL_cla_opt';
0520 sMKL_cla_opt.name    = 'Optimize hyper-parameter';
0521 sMKL_cla_opt.help    = {['Whether to optimize C, the SVM hyper-parameter, or not. '...
0522     'If Yes, than provide a range of possible values for C, in the form '...
0523     'min:step:max. Examples: 10.^[-2:5] or 1:100:1000 or 0.01 0.1 1 10 100. ' ...
0524     'If not, a default value will be used (C=1).']};
0525 sMKL_cla_opt.labels  = {
0526     'No'
0527     'Yes'
0528     }';
0529 sMKL_cla_opt.values  = {0 1};
0530 sMKL_cla_opt.val     = {0};
0531 
0532 % ---------------------------------------------------------------------
0533 % sMKL_cla_args L1-MKL arguments
0534 % ---------------------------------------------------------------------
0535 sMKL_cla_args         = cfg_entry;
0536 sMKL_cla_args.tag     = 'sMKL_cla_args';
0537 sMKL_cla_args.name    = 'Arguments';
0538 sMKL_cla_args.help    = {['Arguments for prt_machine_sMKL_cla (same as for SVM)',...
0539     'Examples: 10.^[-2:5] or 1:100:1000 or 0.01 0.1 1 10 100.']};
0540 sMKL_cla_args.strtype = 'e';
0541 sMKL_cla_args.val     = {def.model.l1MKLargs};
0542 sMKL_cla_args.num     = [1 Inf];
0543 
0544 % ---------------------------------------------------------------------
0545 % cv_type Cross-validation type
0546 % ---------------------------------------------------------------------
0547 sMKL_cla_cv_type_nested        = cfg_choice;
0548 sMKL_cla_cv_type_nested.tag    = 'cv_type_nested';
0549 sMKL_cla_cv_type_nested.name   = 'Cross-validation type for hyper-parameter optimization';
0550 sMKL_cla_cv_type_nested.values = {cv_loso,cv_lkso, cv_losgo,cv_lksgo, cv_lobo,...
0551     cv_lkbo, cv_loro,cv_custom};
0552 sMKL_cla_cv_type_nested.val    = {cv_loso};
0553 sMKL_cla_cv_type_nested.help   = {'Choose the type of cross-validation to be used'};
0554 
0555 % ---------------------------------------------------------------------
0556 % sMKL_cla simple (L1) MKL
0557 % ---------------------------------------------------------------------
0558 sMKL_cla         = cfg_branch;
0559 sMKL_cla.tag     = 'sMKL_cla';
0560 sMKL_cla.name    = 'L1 Multi-Kernel Learning';
0561 sMKL_cla.help    = {'Multi-Kernel Learning. Choose only if multiple kernels ' ...
0562     'were built during the feature set construction (either multiple modalities or ROIs). ' ...
0563     'It is strongly advised to "normalize" the kernels (in "operations").'};
0564 sMKL_cla.val     = {sMKL_cla_opt, sMKL_cla_args, sMKL_cla_cv_type_nested};
0565 
0566 % ---------------------------------------------------------------------
0567 % gpr_args GPR arguments
0568 % ---------------------------------------------------------------------
0569 gpr_args         = cfg_entry;
0570 gpr_args.tag     = 'gpr_args';
0571 gpr_args.name    = 'Arguments';
0572 gpr_args.help    = {['Arguments for prt_machine_gpr']};
0573 gpr_args.strtype = 's';
0574 gpr_args.val     = {def.model.gprargs};
0575 gpr_args.num     = [1 Inf];
0576 
0577 % ---------------------------------------------------------------------
0578 % gpr GPR
0579 % ---------------------------------------------------------------------
0580 gpr         = cfg_branch;
0581 gpr.tag     = 'gpr';
0582 gpr.name    = 'Gaussian Process Regression';
0583 gpr.help    = {'Gaussian Process Regression'};
0584 gpr.val     = {gpr_args};
0585 
0586 % ---------------------------------------------------------------------
0587 % sMKL_reg_opt L1-MKL : flag whether to optimize the hyperparameter
0588 % ---------------------------------------------------------------------
0589 sMKL_reg_opt         = cfg_menu;
0590 sMKL_reg_opt.tag     = 'sMKL_reg_opt';
0591 sMKL_reg_opt.name    = 'Optimize hyper-parameter';
0592 sMKL_reg_opt.help    = {['Whether to optimize C, the MKL hyper-parameter, or not. '...
0593     'If Yes, than provide a range of possible values for C, in the form '...
0594     'min:step:max. Examples: 10.^[-2:5] or 1:100:1000 or 0.01 0.1 1 10 100. ' ...
0595     'If not, a default value will be used (C=1).']};
0596 sMKL_reg_opt.labels  = {
0597     'No'
0598     'Yes'
0599     }';
0600 sMKL_reg_opt.values  = {0 1};
0601 sMKL_reg_opt.val     = {0};
0602 
0603 % ---------------------------------------------------------------------
0604 % sMKL_reg_args sMKL_reg arguments
0605 % ---------------------------------------------------------------------
0606 sMKL_reg_args         = cfg_entry;
0607 sMKL_reg_args.tag     = 'sMKL_reg_args';
0608 sMKL_reg_args.name    = 'Arguments';
0609 sMKL_reg_args.help    = {['Arguments for prt_machine_sMKL_reg']};
0610 sMKL_reg_args.strtype = 'e';
0611 sMKL_reg_args.val     = {def.model.l1MKLargs};
0612 sMKL_reg_args.num     = [1 Inf];
0613 
0614 % ---------------------------------------------------------------------
0615 % cv_type Cross-validation type
0616 % ---------------------------------------------------------------------
0617 sMKL_reg_cv_type_nested        = cfg_choice;
0618 sMKL_reg_cv_type_nested.tag    = 'cv_type_nested';
0619 sMKL_reg_cv_type_nested.name   = 'Cross-validation type for hyper-parameter optimization';
0620 sMKL_reg_cv_type_nested.values = {cv_loso,cv_lkso, cv_losgo,cv_lksgo, cv_lobo,...
0621     cv_lkbo, cv_loro,cv_custom};
0622 sMKL_reg_cv_type_nested.val    = {cv_loso};
0623 sMKL_reg_cv_type_nested.help   = {'Choose the type of cross-validation to be used'};
0624 
0625 % ---------------------------------------------------------------------
0626 % sMKL_reg sMKL regression
0627 % ---------------------------------------------------------------------
0628 sMKL_reg         = cfg_branch;
0629 sMKL_reg.tag     = 'sMKL_reg';
0630 sMKL_reg.name    = 'Multi-Kernel Regression';
0631 sMKL_reg.help    = {'Multi-Kernel Regression'};
0632 sMKL_reg.val     = {sMKL_reg_opt, sMKL_reg_args, sMKL_reg_cv_type_nested};
0633 
0634 % ---------------------------------------------------------------------
0635 % krr_opt SVM : flag whether to optimize C
0636 % ---------------------------------------------------------------------
0637 krr_opt         = cfg_menu;
0638 krr_opt.tag     = 'krr_opt';
0639 krr_opt.name    = 'Optimize hyper-parameter';
0640 krr_opt.help    = {['Whether to optimize K, the KRR hyper-parameter, or not. '...
0641     'If Yes, than provide a range of possible values for K, in the form '...
0642     'min:step:max. Examples: 10.^[-2:5] or 1:100:1000 or 0.01 0.1 1 10 100. ' ...
0643     'If not, a default value will be used.']};
0644 krr_opt.labels  = {
0645     'No'
0646     'Yes'
0647     }';
0648 krr_opt.values  = {0 1};
0649 krr_opt.val     = {0};
0650 
0651 % ---------------------------------------------------------------------
0652 % krr_args Regression Targets
0653 % ---------------------------------------------------------------------
0654 krr_args         = cfg_entry;
0655 krr_args.tag     = 'krr_args';
0656 krr_args.name    = 'Regularization';
0657 krr_args.help    = {['Regularization for prt_machine_krr. ',...
0658     'Examples: 10.^[-2:5] or 1:100:1000 or 0.01 0.1 1 10 100.']};
0659 krr_args.strtype = 'e';
0660 krr_args.val     = {1};
0661 krr_args.num     = [1 Inf];
0662 
0663 % ---------------------------------------------------------------------
0664 % cv_type Cross-validation type
0665 % ---------------------------------------------------------------------
0666 krr_cv_type_nested        = cfg_choice;
0667 krr_cv_type_nested.tag    = 'cv_type_nested';
0668 krr_cv_type_nested.name   = 'Cross-validation type for hyper-parameter optimization';
0669 krr_cv_type_nested.values = {cv_loso,cv_lkso, cv_losgo,cv_lksgo, cv_lobo,...
0670     cv_lkbo, cv_loro,cv_custom};
0671 krr_cv_type_nested.val    = {cv_loso};
0672 krr_cv_type_nested.help   = {'Choose the type of cross-validation to be used'};
0673 
0674 % ---------------------------------------------------------------------
0675 % KRR group
0676 % ---------------------------------------------------------------------
0677 krr         = cfg_branch;
0678 krr.tag     = 'krr';
0679 krr.name    = 'Kernel Ridge Regression';
0680 krr.help    = {'Kernel Ridge Regression.'};
0681 krr.val     = {krr_opt,krr_args,krr_cv_type_nested};
0682 
0683 % ---------------------------------------------------------------------
0684 % RVR group
0685 % ---------------------------------------------------------------------
0686 rvr         = cfg_branch;
0687 rvr.tag     = 'rvr';
0688 rvr.name    = 'Relevance Vector Regression';
0689 rvr.help    = {'Relevance Vector Regression. Tipping, Michael E.; Smola, Alex (2001).' ...
0690     '"Sparse Bayesian Learning and the Relevance Vector Machine". Journal of Machine Learning Research 1: 211?244.'};
0691 
0692 % ---------------------------------------------------------------------
0693 % rt_args Arguments to RT
0694 % ---------------------------------------------------------------------
0695 rt_args         = cfg_entry;
0696 rt_args.tag     = 'rt_args';
0697 rt_args.name    = 'Ntrees';
0698 rt_args.help    = {['Number of trees in the forest.']};
0699 rt_args.strtype = 'e';
0700 rt_args.val     = {601};
0701 rt_args.num     = [1 1];
0702 
0703 % ---------------------------------------------------------------------
0704 % RT group
0705 % ---------------------------------------------------------------------
0706 rt         = cfg_branch;
0707 rt.tag     = 'rt';
0708 rt.name    = 'Random Forest';
0709 rt.help    = {'Random Forest. Breiman, Leo (2001)."Random Forests". ' ...
0710                'Machine Learning 45:5-32. This is a wrapper around ' ...
0711                'Peter Geurt''s implementation in his Regression Tree ' ...
0712                ' package.' };
0713 rt.val     = {rt_args};
0714 
0715 % % ---------------------------------------------------------------------
0716 % % machine Select Features
0717 % % ---------------------------------------------------------------------
0718 % machine        = cfg_choice;
0719 % machine.tag    = 'machine';
0720 % machine.name   = 'Machine';
0721 % machine.values = {svm,gpc,krr,rvr,rt,custom_machine};
0722 % machine.val    =  {svm};
0723 % machine.help   = {...
0724 %     ['Choose a prediction machine for this model']};
0725 
0726 % ---------------------------------------------------------------------
0727 % machine_cl Select Machine
0728 % ---------------------------------------------------------------------
0729 machine_cl       = cfg_choice;
0730 machine_cl.tag    = 'machine_cl';
0731 machine_cl.name   = 'Machine';
0732 machine_cl.values = {svm, gpc, gpclap, sMKL_cla, custom_machine}; 
0733 machine_cl.val    =  {svm};
0734 machine_cl.help   = {...
0735     ['Choose a prediction machine for this model']};
0736 % Random Trees out since only kernel methods available for the moment
0737 % machine_cl.values = {svm,gpc,gpclap,rt,sMKL_cla,custom_machine};
0738 
0739 % ---------------------------------------------------------------------
0740 % machine_rg Select Machine
0741 % ---------------------------------------------------------------------
0742 machine_rg       = cfg_choice;
0743 machine_rg.tag    = 'machine_rg';
0744 machine_rg.name   = 'Machine';
0745 machine_rg.values = {krr,rvr,gpr,sMKL_reg,custom_machine};
0746 machine_rg.val    =  {krr};
0747 machine_rg.help   = {...
0748     ['Choose a prediction machine for this model']};
0749 
0750 % ---------------------------------------------------------------------
0751 % regression Regression
0752 % ---------------------------------------------------------------------
0753 reggroups         = cfg_repeat;
0754 reggroups.tag     = 'reggroups';
0755 reggroups.name    = 'Groups';
0756 reggroups.help    = {['Add one group to this regression model. Click ''new'' '...
0757                     'or ''repeat'' to add another group.']};
0758 reggroups.num     = [1 Inf];
0759 reggroups.values  = {reg_group};
0760 
0761 % ---------------------------------------------------------------------
0762 % regression Regression
0763 % ---------------------------------------------------------------------
0764 regression         = cfg_branch;
0765 regression.tag     = 'regression';
0766 regression.name    = 'Regression';
0767 regression.help    = {'Add group data and machine for regression.'};
0768 regression.val     = {reggroups, machine_rg};
0769 
0770 % ---------------------------------------------------------------------
0771 % classes Classes
0772 % ---------------------------------------------------------------------
0773 classes         = cfg_repeat;
0774 classes.tag     = 'classes';
0775 classes.name    = 'Classes';
0776 classes.help    = {['Specify which elements belong to this class. Click ''new'' '...
0777                            'or ''repeat'' to add another class.']};
0778 classes.num     = [1 Inf];
0779 classes.values  = {class};
0780 
0781 % ---------------------------------------------------------------------
0782 % classification Classification
0783 % ---------------------------------------------------------------------
0784 classification         = cfg_branch;
0785 classification.tag     = 'classification';
0786 classification.name    = 'Classification';
0787 classification.help    = {'Specify classes and machine for classification.'};
0788 classification.val     = {classes, machine_cl};
0789 
0790 % ---------------------------------------------------------------------
0791 % model_type Model type
0792 % ---------------------------------------------------------------------
0793 model_type        = cfg_choice;
0794 model_type.tag    = 'model_type';
0795 model_type.name   = 'Model Type ';
0796 model_type.values = {classification, regression};
0797 model_type.help   = {'Select which kind of predictive model is to be used.'};
0798 
0799 % ---------------------------------------------------------------------
0800 % include_allscans Include unused scans
0801 % ---------------------------------------------------------------------
0802 include_allscans         = cfg_menu;
0803 include_allscans.tag     = 'include_allscans';
0804 include_allscans.name    = 'Include all scans';
0805 include_allscans.labels  = {
0806     'Yes'
0807     'No'
0808 }';
0809 include_allscans.values  = {1 0};
0810 include_allscans.val     = {0};
0811 include_allscans.help    = {[...
0812     'This option can be used to pass all the scans for each subject to ',...
0813     'the learning machine, regardless of whether they are directly ',...
0814     'involved in the classification or regression problem. For example, ',...
0815     'this can be used to estimate a GLM from the whole timeseries ',...
0816     'for each subject prior to prediction. This would allow the resulting ',...
0817     'regression coefficient images to be used as samples.']};
0818 
0819 % ---------------------------------------------------------------------
0820 % no_op All scans
0821 % ---------------------------------------------------------------------
0822 no_op         = cfg_const;
0823 no_op.tag     = 'no_op';
0824 no_op.name    = 'No operations';
0825 no_op.val     = {1};
0826 no_op.help    = {['No design specified. This option can be used '...
0827     'for modalities (e.g. structural scans) that do not '...
0828     'have an experimental design or for an fMRI design',...
0829     'where you want to include all scans in the timeseries']};
0830 
0831 % ---------------------------------------------------------------------
0832 % data_op Operation
0833 % ---------------------------------------------------------------------
0834 data_op         = cfg_menu;
0835 data_op.tag     = 'data_op';
0836 data_op.name    = 'Operation';
0837 data_op.help    = {'Select an operation to apply.'};
0838 data_op.labels  = {
0839     'Done'
0840     'Sample averaging (within block)'
0841     'Sample averaging (within subject/condition)'
0842     'Mean centre features using training data'
0843     'Normalize samples'
0844     'Perform a GLM (for covariates only)'
0845 }';
0846 data_op.values  = {0 1 2 3 4 5};
0847 data_op.val     = {0};
0848 
0849 % ---------------------------------------------------------------------
0850 % data_op Operation
0851 % ---------------------------------------------------------------------
0852 data_op_mc         = cfg_menu;
0853 data_op_mc.tag     = 'data_op_mc';
0854 data_op_mc.name    = 'Mean centre features';
0855 data_op_mc.help    = {'Select an operation to apply.'};
0856 data_op_mc.labels  = {
0857     'Yes'
0858     'No'
0859 }';
0860 data_op_mc.values  = {1 0};
0861 data_op_mc.val     = {1};
0862 
0863 % ---------------------------------------------------------------------
0864 % other_ops Other Operations
0865 % ---------------------------------------------------------------------
0866 other_ops         = cfg_repeat;
0867 other_ops.tag     = 'other_ops';
0868 other_ops.name    = 'Select Operations';
0869 other_ops.help    = {...
0870     ['Add zero or more operations to be applied to the data before the ',...
0871      'prediction machine is called. These are executed within the ',...
0872      'cross-validation loop (i.e. they respect training/test independence) ',...
0873      'and will be executed in the order specified. ']};
0874 other_ops.num     = [1 Inf];
0875 other_ops.values  = {data_op};
0876 
0877 % ---------------------------------------------------------------------
0878 % use_other_ops Use other operations
0879 % ---------------------------------------------------------------------
0880 use_other_ops        = cfg_choice;
0881 use_other_ops.tag    = 'use_other_ops';
0882 use_other_ops.name   = 'Other Operations';
0883 use_other_ops.values = {no_op, other_ops };
0884 use_other_ops.val    = {no_op};
0885 use_other_ops.help   = {'Include other operations?'};
0886 
0887 % ---------------------------------------------------------------------
0888 % sel_ops Class
0889 % ---------------------------------------------------------------------
0890 sel_ops         = cfg_branch;
0891 sel_ops.tag     = 'sel_ops';
0892 sel_ops.name    = 'Data operations';
0893 sel_ops.help    = {...
0894     ['Specify operations to apply']};
0895 sel_ops.val     = {data_op_mc use_other_ops};
0896 
0897 % ---------------------------------------------------------------------
0898 % data_ops Select Features
0899 % ---------------------------------------------------------------------
0900 data_ops        = cfg_choice;
0901 data_ops.tag    = 'data_ops';
0902 data_ops.name   = 'Data Operations';
0903 data_ops.values = {data_op_mc, sel_ops};
0904 data_ops.val    =  {no_op};
0905 data_ops.help   = {...
0906     ['This branch controls operations that can be applied to the data ',...
0907      'before the data is passed to the classifier. Add zero or more ',...
0908      'operations to be applied. These will be executed in the order ',...
0909      'specified. ']}; 
0910  
0911 % ---------------------------------------------------------------------
0912 % model Model
0913 % ---------------------------------------------------------------------
0914 model        = cfg_exbranch;
0915 model.tag    = 'model';
0916 model.name   = 'Specify model';
0917 model.val    = {infile, ...
0918                 model_name, ...
0919                 use_kernel, ...
0920                 fsets, ...
0921                 model_type, ...
0922                 cv_type,...
0923                 include_allscans,...
0924                 sel_ops};
0925 model.help   = {'Construct model according to design specified'};
0926 model.prog   = @prt_run_model;
0927 model.vout   = @vout_data;
0928 
0929 %------------------------------------------------------------------------
0930 %% Output function
0931 %------------------------------------------------------------------------
0932 function cdep = vout_data(job)
0933 % Specifies the output from this modules, i.e. the filename of the mat file
0934 
0935 cdep(1)            = cfg_dep;
0936 cdep(1).sname      = 'PRT.mat file';
0937 cdep(1).src_output = substruct('.','files');
0938 cdep(1).tgt_spec   = cfg_findspec({{'filter','mat','strtype','e'}});
0939 cdep(2)            = cfg_dep;
0940 cdep(2).sname      = 'Model name';
0941 cdep(2).src_output = substruct('.','mname');
0942 cdep(2).tgt_spec   = cfg_findspec({{'strtype','s'}});
0943 %------------------------------------------------------------------------
0944

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