Package user_functions :: Module model_selection'
[hide private]
[frames] | no frames]

Source Code for Module user_functions.model_selection'

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003-2012 Edward d'Auvergne                                   # 
  4  #                                                                             # 
  5  # This file is part of the program relax.                                     # 
  6  #                                                                             # 
  7  # relax is free software; you can redistribute it and/or modify               # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation; either version 2 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # relax is distributed in the hope that it will be useful,                    # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with relax; if not, write to the Free Software                        # 
 19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  # Module docstring. 
 24  """The model_selection user function definitions.""" 
 25   
 26  # relax module imports. 
 27  from generic_fns import model_selection, pipes 
 28  from graphics import WIZARD_IMAGE_PATH 
 29  from user_functions.data import Uf_info; uf_info = Uf_info() 
 30  from user_functions.objects import Desc_container 
 31   
 32   
 33  # The model_selection user function. 
 34  uf = uf_info.add_uf('model_selection') 
 35  uf.title = "Select the best model from a set of optimised models." 
 36  uf.title_short = "Model selection." 
 37  uf.display = True 
 38  uf.add_keyarg( 
 39      name = "method", 
 40      default = "AIC", 
 41      py_type = "str", 
 42      desc_short = "model selection method", 
 43      desc = "The model selection technique (see below).", 
 44      wiz_element_type = 'combo', 
 45      wiz_combo_choices = [ 
 46          "Akaike's Information Criteria", 
 47          "Small sample size corrected AIC", 
 48          "Bayesian or Schwarz Information Criteria", 
 49          "Bootstrap model selection", 
 50          "Single-item-out cross-validation", 
 51          "Expected overall discrepancy", 
 52          "Farrow et al., 1994", 
 53          "Mandel et al., 1995", 
 54          "Realised overall discrepancy" 
 55      ], 
 56      wiz_combo_data = [ 
 57          "AIC", 
 58          "AICc", 
 59          "BIC", 
 60          "Bootstrap", 
 61          "CV", 
 62          "Expect", 
 63          "Farrow", 
 64          "Palmer", 
 65          "Overall" 
 66      ], 
 67      wiz_read_only = True 
 68  ) 
 69  uf.add_keyarg( 
 70      name = "modsel_pipe", 
 71      py_type = "str", 
 72      desc_short = "model selection data pipe name", 
 73      desc = "The name of the new data pipe which will be created by this user function by the copying of the selected data pipe." 
 74  ) 
 75  uf.add_keyarg( 
 76      name = "bundle", 
 77      py_type = "str", 
 78      desc_short = "pipe bundle", 
 79      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.", 
 80      wiz_element_type = 'combo', 
 81      wiz_combo_iter = pipes.bundle_names, 
 82      wiz_read_only = False, 
 83      can_be_none = True 
 84  ) 
 85  uf.add_keyarg( 
 86      name = "pipes", 
 87      py_type = "str_list_of_lists", 
 88      desc_short = "data pipes", 
 89      desc = "An array containing the names of all data pipes to include in model selection.", 
 90      wiz_element_type = 'combo_list', 
 91      wiz_combo_iter = pipes.pipe_names, 
 92      wiz_read_only = True, 
 93      can_be_none = True 
 94  ) 
 95  # Description. 
 96  uf.desc.append(Desc_container()) 
 97  uf.desc[-1].add_paragraph("The following model selection methods are supported:") 
 98  uf.desc[-1].add_item_list_element("AIC", "Akaike's Information Criteria.") 
 99  uf.desc[-1].add_item_list_element("AICc", "Small sample size corrected AIC.") 
100  uf.desc[-1].add_item_list_element("BIC", "Bayesian or Schwarz Information Criteria.") 
101  uf.desc[-1].add_item_list_element("Bootstrap", "Bootstrap model selection.") 
102  uf.desc[-1].add_item_list_element("CV", "Single-item-out cross-validation.") 
103  uf.desc[-1].add_item_list_element("Expect", "The expected overall discrepancy (the true values of the parameters are required).") 
104  uf.desc[-1].add_item_list_element("Farrow", "Old model-free method by Farrow et al., 1994.") 
105  uf.desc[-1].add_item_list_element("Palmer", "Old model-free method by Mandel et al., 1995.") 
106  uf.desc[-1].add_item_list_element("Overall", "The realised overall discrepancy (the true values of the parameters are required).") 
107  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.") 
108  uf.desc[-1].add_paragraph("If the data pipes have not been specified, then all data pipes will be used for model selection.") 
109  # Prompt examples. 
110  uf.desc.append(Desc_container("Prompt examples")) 
111  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:") 
112  uf.desc[-1].add_prompt("relax> model_selection('AIC', 'mixed')") 
113  uf.desc[-1].add_prompt("relax> model_selection(method='AIC', modsel_pipe='mixed')") 
114  uf.desc[-1].add_prompt("relax> model_selection('AIC', 'mixed', ['m1', 'm2', 'm3', 'm4', 'm5'])") 
115  uf.desc[-1].add_prompt("relax> model_selection(method='AIC', modsel_pipe='mixed', pipes=['m1', 'm2', 'm3', 'm4', 'm5'])") 
116  uf.backend = model_selection.select 
117  uf.menu_text = "m&odel_selection" 
118  uf.gui_icon = "relax.discrepancy_curve" 
119  uf.wizard_height_desc = 450 
120  uf.wizard_size = (900, 750) 
121  uf.wizard_image = WIZARD_IMAGE_PATH + 'discrepancy_curve.png' 
122