From 97686c528e31467494f1819f0f4ec50af6b63f7d Mon Sep 17 00:00:00 2001 From: Matthias Cuntz Date: Mon, 6 Apr 2020 22:58:55 +0200 Subject: [PATCH] Sample not only from uniform distribution but allow all distributions of scipy.stats in morris_sampling, screening/eee, and eee/see. --- docs/source/userguide.rst | 22 +++++++++++----------- pyeee/eee.py | 2 +- pyeee/morris_method.py | 2 +- pyeee/screening.py | 7 +++---- pyeee/version.py | 2 +- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/docs/source/userguide.rst b/docs/source/userguide.rst index 9f97876..03d31d0 100644 --- a/docs/source/userguide.rst +++ b/docs/source/userguide.rst @@ -332,16 +332,16 @@ limits `0` and `1`. The three parameters :math:`x_0, x_1, x_2` of the Ishigami-Homma function follow uniform distributions between :math:`-\pi` and -:math:`+\pi`. Say that :math:`x_1` follows a Gaussian -distribution around the mean `0` with a standard deviation of 1.81. We -want to sample between three standard deviations, which includes about -99.7\% of the total distribution. This means that the lower bound -would be 0.0015 and the upper bound 0.9985. +:math:`+\pi`. Say that :math:`x_1` follows a Gaussian distribution +around the mean `0` with a standard deviation of 1.81. We want to +sample between plus or minus three standard deviations, which includes +about 99.7\% of the total distribution. This means that the lower +bound would be 0.0015 (0.003/2.) and the upper bound 0.9985. .. code-block:: python import scipy.stats as stats - dist = [None, stats.normal, stats.uniform] + dist = [None, stats.norm, stats.uniform] distparam = [None, (0., 1.81), (-np.pi, 2.*np.pi)] lb = [-np.pi, 0.0015, 0.] ub = [np.pi, 0.9985, 1.] @@ -361,16 +361,16 @@ This shows that :any:`scipy.stats.uniform`, `loc` is the lower limit and `loc+scale` the upper limit. This means the combination `dist=None`, `lb=a`, `ub=b` corresponds to - `dist=scipy.stats.uniform`, `distparam=[a,b-a]`, `lb=0`, `ub=1`. + `dist=scipy.stats.uniform`, `distparam=[a,b-a]`, `lb=0`, + `ub=1`. Note also that 5. if `distparam==None`, `loc=0` and `scale=1` will be taken; 6. `loc` and `scale` are implemented as keywords in - :any:`scipy.stats`. Other parameters such as the shape - parameter of the gamma distribution - :any:`scipy.stats.gamma` must hence be given first, - e.g. `(shape,loc,scale)`. + :any:`scipy.stats`. Other parameters such as for example the shape + parameter of the gamma distribution :any:`scipy.stats.gamma` must + hence be given first, i.e. `(shape,loc,scale)`. Remember that Morris' method of Elementary Effects assumes uniformly distributed parameters and that other distributions are an extension diff --git a/pyeee/eee.py b/pyeee/eee.py index 09d6da0..7f2cfa1 100644 --- a/pyeee/eee.py +++ b/pyeee/eee.py @@ -116,7 +116,7 @@ def eee(func, *args, **kwargs): If True, return weighted mean mu*, weighted by sd. seed : int or array_like - Seed for numpy``s random number generator (default: None). + Seed for numpy's random number generator (default: None). processes : int, optinal The number of processes to use to evaluate objective function and constraints (default: 1). pool : `schwimmbad` pool object, optinal diff --git a/pyeee/morris_method.py b/pyeee/morris_method.py index a37813c..420579e 100644 --- a/pyeee/morris_method.py +++ b/pyeee/morris_method.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from __future__ import division, absolute_import, print_function """ -Module provides the Morris Method of Elementary Effects. +Module provides the Morris' Method of Elementary Effects. It includes optimised sampling of trajectories including optional groups as well as calculation of the Morris measures mu, stddev and mu*. diff --git a/pyeee/screening.py b/pyeee/screening.py index e25ccf4..7798b55 100644 --- a/pyeee/screening.py +++ b/pyeee/screening.py @@ -1,8 +1,7 @@ #!/usr/bin/env python from __future__ import division, absolute_import, print_function """ -screening : Provides the function screening/ee for Morris' method - of Elementary Effects. +screening : Provides the function screening/ee for Morris' method of Elementary Effects. This function was written by Matthias Cuntz while at Institut National de Recherche en Agriculture, Alimentation et Environnement (INRAE), @@ -47,7 +46,7 @@ def screening(func, lb, ub, nt, x0=None, mask=None, processes=1, pool=None, verbose=0): """ - Parameter screening using Morris method of Elementary Effects. + Parameter screening using Morris' method of Elementary Effects. Note, the input function must be callable as `func(x)`. @@ -103,7 +102,7 @@ def screening(func, lb, ub, nt, x0=None, mask=None, The percent point function ppf is called like this: dist(*distparam).ppf(x) seed : int or array_like - Seed for numpy``s random number generator (default: None). + Seed for numpy's random number generator (default: None). processes : int, optional The number of processes to use to evaluate objective function and constraints (default: 1). pool : `schwimmbad` pool object, optional diff --git a/pyeee/version.py b/pyeee/version.py index 567c887..1064a52 100644 --- a/pyeee/version.py +++ b/pyeee/version.py @@ -23,7 +23,7 @@ * v0.9, Renamed morris.py to morris_method.py and adapted args and kwargs to common names in pyeee, Feb 2020, Matthias Cuntz * v1.0, Restructured package with functions and utils subpackages, Feb 2020, Matthias Cuntz * v1.1, Number of final trajectories is argument instead of keyword, Feb 2020, Matthias Cuntz -* v1.2, Sample not only from uniform distribution but allow all distributions of scipy.stats, Mar 2020, Matthias Cuntz +* v1.2, Sample not only from uniform distribution but allow all distributions of scipy.stats, Apr 2020, Matthias Cuntz .. moduleauthor:: Matthias Cuntz """