1.4. Sampling¶
Sampling Strategy, Experimental Design
- MOEA selection strategy:
- 1.Random sampling 2.Best sampling 3.Tournament sampling 4.Tournament+Best sampling
- Links:
-
https://en.wikipedia.org/wiki/Sampling_(statistics)
https://en.wikipedia.org/wiki/Latin_hypercube_sampling
https://docs.scipy.org/doc/numpy/reference/routines.random.html
- Factorial Designs:
- samFullFact, samFracFact, samFF2n, samPlackettBurman
- Response-Surface Designs:
- samBoxBehnken, samCentralComposite
- Randomized Designs:
- samLatinHypercube
1.4.1. samBoxBehnken¶
-
surrogate.sampling.
samBoxBehnken
()[source]¶ Create a Box-Behnken design
Parameters: - n – The number of factors in the design
- center – The number of center points to include (default = 1).
Returns: The design matrix
This code was originally published by the following individuals for use with Scilab:
- Copyright (C) 2012 - 2013 - Michael Baudin
- Copyright (C) 2012 - Maria Christopoulou
- Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
- Copyright (C) 2009 - Yann Collette
- Copyright (C) 2009 - CEA - Jean-Marc Martinez
website: forge.scilab.org/index.php/p/scidoe/sourcetree/master/macros
Much thanks goes to these individuals. It has been converted to Python by Abraham Lee.
Example: >>> samBoxBehnken(3) array([[-1., -1., 0.], [ 1., -1., 0.], [-1., 1., 0.], [ 1., 1., 0.], [-1., 0., -1.], [ 1., 0., -1.], [-1., 0., 1.], [ 1., 0., 1.], [ 0., -1., -1.], [ 0., 1., -1.], [ 0., -1., 1.], [ 0., 1., 1.], [ 0., 0., 0.], [ 0., 0., 0.], [ 0., 0., 0.]])
1.4.2. samCentralComposite¶
-
surrogate.sampling.
samCentralComposite
()[source]¶ Central composite design
Parameters: - n – The number of factors in the design.
- center – A 1-by-2 array of integers, the number of center points in each block of the design. (Default: (4, 4)).
- alpha –
A string describing the effect of alpha has on the variance.
alpha
can take on the following values:- ’orthogonal’ or ‘o’ (Default)
- ’rotatable’ or ‘r’
- face –
The relation between the start points and the corner (factorial) points.
There are three options for this input:
- ’circumscribed’ or ‘ccc’: This is the original form of the central
composite design. The star points are at some distance
alpha
from the center, based on the properties desired for the design. The start points establish new extremes for the low and high settings for all factors. These designs have circular, spherical, or hyperspherical symmetry and require 5 levels for each factor. Augmenting an existing factorial or resolution V fractional factorial design with star points can produce this design. - ’inscribed’ or ‘cci’: For those situations in which the limits
specified for factor settings are truly limits, the CCI design
uses the factors settings as the star points and creates a factorial
or fractional factorial design within those limits (in other words,
a CCI design is a scaled down CCC design with each factor level of
the CCC design divided by
alpha
to generate the CCI design). This design also requires 5 levels of each factor. - ’faced’ or ‘ccf’: In this design, the star points are at the center
of each face of the factorial space, so
alpha
= 1. This variety requires 3 levels of each factor. Augmenting an existing factorial or resolution V design with appropriate star points can also produce this design.
- ’circumscribed’ or ‘ccc’: This is the original form of the central
composite design. The star points are at some distance
Returns: The design matrix with coded levels -1 and 1
This code was originally published by the following individuals for use with Scilab:
- Copyright (C) 2012 - 2013 - Michael Baudin
- Copyright (C) 2012 - Maria Christopoulou
- Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
- Copyright (C) 2009 - Yann Collette
- Copyright (C) 2009 - CEA - Jean-Marc Martinez
website: forge.scilab.org/index.php/p/scidoe/sourcetree/master/macros
Much thanks goes to these individuals. It has been converted to Python by Abraham Lee.
Note
- Fractional factorial designs are not (yet) available here.
- ‘ccc’ and ‘cci’ can be rotatable design, but ‘ccf’ cannot.
- If
face
is specified, whilealpha
is not, then the default value ofalpha
is ‘orthogonal’.
Example: >>> samCentralComposite(3) array([[-1. , -1. , -1. ], [ 1. , -1. , -1. ], [-1. , 1. , -1. ], [ 1. , 1. , -1. ], [-1. , -1. , 1. ], [ 1. , -1. , 1. ], [-1. , 1. , 1. ], [ 1. , 1. , 1. ], [ 0. , 0. , 0. ], [ 0. , 0. , 0. ], [ 0. , 0. , 0. ], [ 0. , 0. , 0. ], [-1.82574186, 0. , 0. ], [ 1.82574186, 0. , 0. ], [ 0. , -1.82574186, 0. ], [ 0. , 1.82574186, 0. ], [ 0. , 0. , -1.82574186], [ 0. , 0. , 1.82574186], [ 0. , 0. , 0. ], [ 0. , 0. , 0. ], [ 0. , 0. , 0. ], [ 0. , 0. , 0. ]])
1.4.3. samFullFact¶
-
surrogate.sampling.
samFullFact
()[source]¶ Create a general full-factorial design
Parameters: levels – An array of integers that indicate the number of levels of each input design factor. Returns: The design matrix with coded levels 0 to k-1 for a k-level factor This code was originally published by the following individuals for use with Scilab:
- Copyright (C) 2012 - 2013 - Michael Baudin
- Copyright (C) 2012 - Maria Christopoulou
- Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
- Copyright (C) 2009 - Yann Collette
- Copyright (C) 2009 - CEA - Jean-Marc Martinez
website: forge.scilab.org/index.php/p/scidoe/sourcetree/master/macros
Much thanks goes to these individuals. It has been converted to Python by Abraham Lee.
Example: >>> samFullFact([2, 4, 3]) array([[ 0., 0., 0.], [ 1., 0., 0.], [ 0., 1., 0.], [ 1., 1., 0.], [ 0., 2., 0.], [ 1., 2., 0.], [ 0., 3., 0.], [ 1., 3., 0.], [ 0., 0., 1.], [ 1., 0., 1.], [ 0., 1., 1.], [ 1., 1., 1.], [ 0., 2., 1.], [ 1., 2., 1.], [ 0., 3., 1.], [ 1., 3., 1.], [ 0., 0., 2.], [ 1., 0., 2.], [ 0., 1., 2.], [ 1., 1., 2.], [ 0., 2., 2.], [ 1., 2., 2.], [ 0., 3., 2.], [ 1., 3., 2.]])
1.4.4. samLatinHypercube¶
-
surrogate.sampling.
samLatinHypercube
()[source]¶ Generate a latin-hypercube design
Parameters: - n – The number of factors to generate samples for
- samples – The number of samples to generate for each factor (Default: n)
- criterion – Allowable values are “center” or “c”, “maximin” or “m”, “centermaximin” or “cm”, and “correlation” or “corr”. If no value given, the design is simply randomized.
- iterations – The number of iterations in the maximin and correlations algorithms (Default: 5).
Returns: An n-by-samples design matrix that has been normalized so factor values are uniformly spaced between zero and one.
This code was originally published by the following individuals for use with Scilab:
- Copyright (C) 2012 - 2013 - Michael Baudin
- Copyright (C) 2012 - Maria Christopoulou
- Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
- Copyright (C) 2009 - Yann Collette
- Copyright (C) 2009 - CEA - Jean-Marc Martinez
website: forge.scilab.org/index.php/p/scidoe/sourcetree/master/macros
Much thanks goes to these individuals. It has been converted to Python by Abraham Lee.
Example: A 3-factor design (defaults to 3 samples):
>>> samLatinHypercube(3) array([[ 0.40069325, 0.08118402, 0.69763298], [ 0.19524568, 0.41383587, 0.29947106], [ 0.85341601, 0.75460699, 0.360024 ]])
A 4-factor design with 6 samples:
>>> samLatinHypercube(4, samples=6) array([[ 0.27226812, 0.02811327, 0.62792445, 0.91988196], [ 0.76945538, 0.43501682, 0.01107457, 0.09583358], [ 0.45702981, 0.76073773, 0.90245401, 0.18773015], [ 0.99342115, 0.85814198, 0.16996665, 0.65069309], [ 0.63092013, 0.22148567, 0.33616859, 0.36332478], [ 0.05276917, 0.5819198 , 0.67194243, 0.78703262]])
A 2-factor design with 5 centered samples:
>>> samLatinHypercube(2, samples=5, criterion='center') array([[ 0.3, 0.5], [ 0.7, 0.9], [ 0.1, 0.3], [ 0.9, 0.1], [ 0.5, 0.7]])
A 3-factor design with 4 samples where the minimum distance between all samples has been maximized:
>>> samLatinHypercube(3, samples=4, criterion='maximin') array([[ 0.02642564, 0.55576963, 0.50261649], [ 0.51606589, 0.88933259, 0.34040838], [ 0.98431735, 0.0380364 , 0.01621717], [ 0.40414671, 0.33339132, 0.84845707]])
A 4-factor design with 5 samples where the samples are as uncorrelated as possible (within 10 iterations):
>>> samLatinHypercube(4, samples=5, criterion='correlate', iterations=10)
1.4.5. samOptimalLHC¶
-
surrogate.sampling.
samOptimalLHC
()[source]¶ Generates an optimized Latin hypercube by optimizing the Morris-Mitchell criterion for a range of exponents and plots the first two dimensions of the current hypercube throughout the optimization process.
Parameters: - n – number of points required
- Population – number of individuals in the evolutionary operation optimizer
- Iterations – number of generations the evolutionary operation optimizer is run for
Returns: X optimized Latin hypercube
Note
high values for the two inputs above will ensure high quality hypercubes, but the search will take longer. generation - if set to True, the LHC will be generated. If ‘False,’ the algorithm will check for an existing plan before generating.
1.4.6. samPlackettBurman¶
-
surrogate.sampling.
samPlackettBurman
()[source]¶ Generate a Plackett-Burman design
Parameters: n – The number of factors to create a matrix for. Returns: An orthogonal design matrix with n columns, one for each factor, and the number of rows being the next multiple of 4 higher than n (e.g., for 1-3 factors there are 4 rows, for 4-7 factors there are 8 rows, etc.) This code was originally published by the following individuals for use with Scilab:
- Copyright (C) 2012 - 2013 - Michael Baudin
- Copyright (C) 2012 - Maria Christopoulou
- Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
- Copyright (C) 2009 - Yann Collette
- Copyright (C) 2009 - CEA - Jean-Marc Martinez
website: forge.scilab.org/index.php/p/scidoe/sourcetree/master/macros
Much thanks goes to these individuals. It has been converted to Python by Abraham Lee.
Example: A 3-factor design:
>>> samPlackettBurman(3) array([[-1., -1., 1.], [ 1., -1., -1.], [-1., 1., -1.], [ 1., 1., 1.]])
A 5-factor design:
>>> samPlackettBurman(5) array([[-1., -1., 1., -1., 1.], [ 1., -1., -1., -1., -1.], [-1., 1., -1., -1., 1.], [ 1., 1., 1., -1., -1.], [-1., -1., 1., 1., -1.], [ 1., -1., -1., 1., 1.], [-1., 1., -1., 1., -1.], [ 1., 1., 1., 1., 1.]])
1.4.7. samRandom¶
1.4.8. samRandomLHC¶
-
surrogate.sampling.
samRandomLHC
()[source]¶ Generates a random latin hypercube within the [0,1]^k hypercube
Parameters: - n – desired number of points
- k – number of design variables (dimensions)
- Edges – if Edges=1 the extreme bins will have their centers on the edges of the domain
Returns: Latin hypercube sampling plan of n points in k dimensions