1   
  2   
  3   
  4   
  5   
  6   
  7   
  8   
  9   
 10   
 11   
 12   
 13   
 14   
 15   
 16   
 17   
 18   
 19   
 20   
 21   
 22   
 23  """The model_selection user function definitions.""" 
 24   
 25   
 26  from generic_fns import model_selection, pipes 
 27  from graphics import WIZARD_IMAGE_PATH 
 28  from user_functions.data import Uf_info; uf_info = Uf_info() 
 29  from user_functions.objects import Desc_container 
 30   
 31   
 32   
 33  uf = uf_info.add_uf('model_selection') 
 34  uf.title = "Select the best model from a set of optimised models." 
 35  uf.title_short = "Model selection." 
 36  uf.display = True 
 37  uf.add_keyarg( 
 38      name = "method", 
 39      default = "AIC", 
 40      py_type = "str", 
 41      desc_short = "model selection method", 
 42      desc = "The model selection technique (see below).", 
 43      wiz_element_type = 'combo', 
 44      wiz_combo_choices = [ 
 45          "Akaike's Information Criteria", 
 46          "Small sample size corrected AIC", 
 47          "Bayesian or Schwarz Information Criteria", 
 48          "Bootstrap model selection", 
 49          "Single-item-out cross-validation", 
 50          "Expected overall discrepancy", 
 51          "Farrow et al., 1994", 
 52          "Mandel et al., 1995", 
 53          "Realised overall discrepancy" 
 54      ], 
 55      wiz_combo_data = [ 
 56          "AIC", 
 57          "AICc", 
 58          "BIC", 
 59          "Bootstrap", 
 60          "CV", 
 61          "Expect", 
 62          "Farrow", 
 63          "Palmer", 
 64          "Overall" 
 65      ], 
 66      wiz_read_only = True 
 67  ) 
 68  uf.add_keyarg( 
 69      name = "modsel_pipe", 
 70      py_type = "str", 
 71      desc_short = "model selection data pipe name", 
 72      desc = "The name of the new data pipe which will be created by this user function by the copying of the selected data pipe." 
 73  ) 
 74  uf.add_keyarg( 
 75      name = "bundle", 
 76      py_type = "str", 
 77      desc_short = "pipe bundle", 
 78      desc = "The optional pipe bundle is a special grouping or clustering of data pipes.  If this is specified, the newly created data pipe will be added to this bundle.", 
 79      wiz_element_type = 'combo', 
 80      wiz_combo_iter = pipes.bundle_names, 
 81      wiz_read_only = False, 
 82      can_be_none = True 
 83  ) 
 84  uf.add_keyarg( 
 85      name = "pipes", 
 86      py_type = "str_list_of_lists", 
 87      desc_short = "data pipes", 
 88      desc = "An array containing the names of all data pipes to include in model selection.", 
 89      wiz_element_type = 'combo_list', 
 90      wiz_combo_iter = pipes.pipe_names, 
 91      wiz_read_only = True, 
 92      can_be_none = True 
 93  ) 
 94   
 95  uf.desc.append(Desc_container()) 
 96  uf.desc[-1].add_paragraph("The following model selection methods are supported:") 
 97  uf.desc[-1].add_item_list_element("AIC", "Akaike's Information Criteria.") 
 98  uf.desc[-1].add_item_list_element("AICc", "Small sample size corrected AIC.") 
 99  uf.desc[-1].add_item_list_element("BIC", "Bayesian or Schwarz Information Criteria.") 
100  uf.desc[-1].add_item_list_element("Bootstrap", "Bootstrap model selection.") 
101  uf.desc[-1].add_item_list_element("CV", "Single-item-out cross-validation.") 
102  uf.desc[-1].add_item_list_element("Expect", "The expected overall discrepancy (the true values of the parameters are required).") 
103  uf.desc[-1].add_item_list_element("Farrow", "Old model-free method by Farrow et al., 1994.") 
104  uf.desc[-1].add_item_list_element("Palmer", "Old model-free method by Mandel et al., 1995.") 
105  uf.desc[-1].add_item_list_element("Overall", "The realised overall discrepancy (the true values of the parameters are required).") 
106  uf.desc[-1].add_paragraph("For the methods 'Bootstrap', 'Expect', and 'Overall', the Monte Carlo simulations should have previously been executed with the monte_carlo.create_data method set to Bootstrapping to modify its behaviour.") 
107  uf.desc[-1].add_paragraph("If the data pipes have not been specified, then all data pipes will be used for model selection.") 
108   
109  uf.desc.append(Desc_container("Prompt examples")) 
110  uf.desc[-1].add_paragraph("For model-free analysis, if the preset models 1 to 5 are minimised and loaded into the program, the following commands will carry out AIC model selection and to place the selected results into the 'mixed' data pipe, type one of:") 
111  uf.desc[-1].add_prompt("relax> model_selection('AIC', 'mixed')") 
112  uf.desc[-1].add_prompt("relax> model_selection(method='AIC', modsel_pipe='mixed')") 
113  uf.desc[-1].add_prompt("relax> model_selection('AIC', 'mixed', ['m1', 'm2', 'm3', 'm4', 'm5'])") 
114  uf.desc[-1].add_prompt("relax> model_selection(method='AIC', modsel_pipe='mixed', pipes=['m1', 'm2', 'm3', 'm4', 'm5'])") 
115  uf.backend = model_selection.select 
116  uf.menu_text = "m&odel_selection" 
117  uf.gui_icon = "relax.discrepancy_curve" 
118  uf.wizard_height_desc = 450 
119  uf.wizard_size = (900, 750) 
120  uf.wizard_image = WIZARD_IMAGE_PATH + 'discrepancy_curve.png' 
121