Add recommended options for users to supply custom parameter bounds to the SA process.
tobeycarman opened this issue · 1 comments
Currently in SA_setup_and_run.py
the parameter sampling bounds are set only from the config file and are even around the initial value. The example sampling range is set to +/- 90% of initial value.
Users would like two things:
-
better support for expanded ranges - this might exist already by simply setting the values in the
percent_diffs
array to something greater than 1.0. -
support for sampling bounds to be uneven with respect to the initial value (for example lower bound -5% of initial value, upper bound +600% of initial value).
This is not handled not by the SA_setup_and_run.py
script, however a user could manually do it by writing their own wrapper (custom copy of SA_setup_and_run.py
) or interactively in a python session, something like this:
import drivers.Sensitivity
driver = drivers.Sensitivity.Sensitivity.fromfilename(config_file_name)
At this point the sample matrix is setup according to the params and percent diffs in the config file. For example:
driver.params[0]
{'name': 'nmax',
'bounds': [0.4099999999999997, 7.789999999999999],
'initial': 4.1,
'cmtnum': 6,
'pftnum': 0}
And
driver.sample_matrix['nmax_pft0']
0 5.596648
1 1.566672
2 6.899297
3 2.804200
4 4.634849
Name: nmax_pft0, dtype: float64
If want custom bounds, you can supply them and then re-generate the sample matrix:
driver.params[0]['bounds']=[-2000, 1000]
driver.sample_matrix = drivers.Sensitivity.generate_lhc( len(driver.sample_matrix), driver.params )
driver.sample_matrix['nmax_pft0']
Out[18]:
0 -467.464092
1 -1996.862232
2 856.594456
3 -178.813187
4 -952.559730
Name: nmax_pft0, dtype: float64
It would be nice to better support this with settings in the .yaml
config file so users do not need to write their own script.
Addressed this in sha: 912c0ee .
Opted to expose this in the config file. More details in the sample configs.