mailr24730 - in /branches/frame_order_cleanup: ./ pipe_control/minimise.py user_functions/minimisation.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 24, 2014 - 18:49:
Author: bugman
Date: Thu Jul 24 18:49:58 2014
New Revision: 24730

URL: http://svn.gna.org/viewcvs/relax?rev=24730&view=rev
Log:
Merged revisions 24729 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r24729 | bugman | 2014-07-24 18:38:04 +0200 (Thu, 24 Jul 2014) | 5 lines
  
  Improved the logic for skipping parameters in the grid search.
  
  The logic is also fully explained in the user function documentation.
........

Modified:
    branches/frame_order_cleanup/   (props changed)
    branches/frame_order_cleanup/pipe_control/minimise.py
    branches/frame_order_cleanup/user_functions/minimisation.py

Propchange: branches/frame_order_cleanup/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jul 24 18:49:58 2014
@@ -1 +1 @@
-/trunk:1-24727
+/trunk:1-24729

Modified: branches/frame_order_cleanup/pipe_control/minimise.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/pipe_control/minimise.py?rev=24730&r1=24729&r2=24730&view=diff
==============================================================================
--- branches/frame_order_cleanup/pipe_control/minimise.py       (original)
+++ branches/frame_order_cleanup/pipe_control/minimise.py       Thu Jul 24 
18:49:58 2014
@@ -303,6 +303,10 @@
             # Alias the number of increments for this parameter.
             incs = model_inc[-1][i]
 
+            # Error checking for increment values of None.
+            if incs == None and values[i] in [None, {}, []]:
+                raise RelaxError("The parameter '%s' has no preset value, 
therefore a grid increment of None is not valid." % names[i])
+
             # The lower bound for this parameter.
             if lower != None:
                 lower_i = lower[i]
@@ -315,15 +319,38 @@
             else:
                 upper_i = param_object.grid_upper(names[i], incs=incs, 
model_info=model_info)
 
+            # The skipping logic.
+            skip = False
+            if skip_preset:
+                # Override the flag if the zoom is on.
+                if zoom:
+                    skip = False
+
+                # No preset value.
+                elif values[i] in [None, {}, []]:
+                    skip = False
+
+                # The preset value is a NaN value due to numpy conversions 
of None.
+                elif isNaN(values[i]):
+                    skip = False
+
+                # Ok, now the parameter can be skipped.
+                else:
+                    skip = True
+
+            # Override the skip flag if the incs value is None.
+            if incs == None:
+                skip = True
+
             # Skip preset values.
-            if not zoom and skip_preset and not values[i] in [None, {}, []] 
and not isNaN(values[i]):
+            if skip:
                 lower_i = values[i]
                 upper_i = values[i]
                 model_inc[-1][i] = incs = 1
                 comment = 'Preset value'
 
             # Zooming grid.
-            if zoom:
+            elif zoom:
                 # The full size and scaled size.
                 size = upper_i - lower_i
                 zoom_size = size * zoom_factor

Modified: branches/frame_order_cleanup/user_functions/minimisation.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/user_functions/minimisation.py?rev=24730&r1=24729&r2=24730&view=diff
==============================================================================
--- branches/frame_order_cleanup/user_functions/minimisation.py (original)
+++ branches/frame_order_cleanup/user_functions/minimisation.py Thu Jul 24 
18:49:58 2014
@@ -366,13 +366,14 @@
     default = True,
     py_type = "bool",
     desc_short = "skip preset parameter flag",
-    desc = "This argument, when True, allows any parameter which already has 
a value set to be skipped in the grid search."
+    desc = "This argument, when True, allows any parameter which already has 
a value set to be skipped in the grid search.  This value will be overridden 
and turned off when a zooming grid search is active."
 )
 # Description.
 uf.desc.append(Desc_container())
 uf.desc[-1].add_paragraph("The optimisation of a mathematical model normally 
consists of two parts - a coarse grid search across the parameter space to 
find an initial set of parameter values followed by the use of a high 
precision optimisation algorithm to exactly find the local or global 
solution.  The grid search is an essential tool as it allows a non-biased 
initial optimisation position to be found.  It avoids the statistical bias 
and preconditioning introduced by using a self chosen initial parameter set.  
The high computational cost of the grid search is almost always favourable to 
the statistical bias of a user defined starting position.")
 uf.desc[-1].add_paragraph("The region of the parameter space that the grid 
search covers is defined by the lower and upper grid bounds.  These will 
generally default to the entire parameter space except for when the parameter 
is non-bounded, for example a 3D position in the PDB space.  This user 
function will print out the grid bounds used and, if the default bounds are 
deemed to be insufficient, then the lower, upper or both bounds can supplied. 
 This only works if all active models have the same parameters.  The 
coarseness or fineness of the grid is defined by the number of increments to 
search across between the bounds.  For an alternative to using large numbers 
of increments, see the zooming grid search.")
 uf.desc[-1].add_paragraph("It is possible to decrease the dimensionality of 
the grid search, and hence drop the computational cost by orders of 
magnitude, if certain parameter values are know a priori.  For example if the 
values are determined via a different experiment.  Such parameters can be set 
with the value setting user function.  Then, when the skip preset flag is 
set, these parameters will be skipped in the grid search.  This feature 
should not be abused and statistical bias should be avoided at all cost.")
+uf.desc[-1].add_paragraph("The parameter skipping logic is as follows.  
Firstly setting the increments argument to a list with None elements causes 
the corresponding parameters to be skipped in the grid search, or an error to 
be raised if no preset parameter is present.  This overrides all other 
settings.  Secondly the preset skipping flag only allows parameters to be 
skipped if the zooming grid search is non-active and a value is preset.")
 uf.backend = minimise.grid_search
 uf.menu_text = "&grid_search"
 uf.gui_icon = "relax.grid_search"




Related Messages


Powered by MHonArc, Updated Thu Jul 24 19:00:02 2014