LOLAVoronoi¶
- class LOLAVoronoi(*args)¶
LOLA-Voronoi sequential design algorithm.
Warning
This class is experimental and likely to be modified in future releases. To use it, import the
openturns.experimental
submodule.This class implements the design of experiments algorithm described in [crombecq2011] which allows one to sequentially generate new input samples according to the input measure and model output. It combines an exploration criterion based on Voronoi tesselation to identify undersampled input design regions and an exploitation criterion based on a measure of the nonlinearity of the model.
Lets define a random vector
with measure
and dimension
,
initial points
and a model
.
The exploration criterion score of the point
is equal to the probability of its Voronoi cell, which can be written as:
for
where
is the sample size and
is the indicator function of the i-th Voronoi cell:
The Voronoi score is approximated using a Monte Carlo experiment.
For the nonlinearity criterion the algorithm only uses the data available and chooses a set of neighbouring samples
with
to build the gradient approximation of the model
at the point
, denoted by
.
The LOLA algorithm local nonlinearity score of the point
is the cumulated error between the model and the linear approximation built from its neighbourhood. For each component
of the model, the local nonlinearity score is given by:
for
where
is the model and
is its linear approximation in the neighbourhood of the point
.
In order to aggregate all the
, we can use two different norms:
or
Now the two metrics are combined into the hybrid score given by:
for
, with
a tradeoff coefficient.
To generate a new point, random points are generated by Monte Carlo close to the reference point
with highest hybrid score. The new point is selected among the generated sample inside the Voronoi cell of
and farthest away from
and its neighbours. To generate a batch of
points this procedure is repeated on the
reference points with highest hybrid score taking into account the voronoi cells of the new candidates.
- Parameters:
- x2-d sequence of float
Initial input sample
- y2-d sequence of float
Initial output sample
- distribution
Distribution
Distribution to generate new input samples
Methods
generate
(size)Generate a new sample.
Accessor to the object's name.
Accessor to the generation indices.
Hybrid score accessor.
Accessor to the input sample.
LOLA score accessor.
getName
()Accessor to the object's name.
Neighbourhood candidates number accessor.
Accessor to the output sample.
Voronoi sampling size accessor.
Voronoi score accessor.
hasName
()Test if the object is named.
setName
(name)Accessor to the object's name.
Neighbourhood candidates number accessor.
setVoronoiSamplingSize
(voronoiSamplingSize)Voronoi sampling size accessor.
update
(x, y)Update the current sample.
Notes
Various
ResourceMap
entries allow for a more fine-grained control over the algorithm:The entry LOLAVoronoi-DefaultNeighbourhoodCandidatesNumber defines the number of extra closest neighbours around each reference point to consider for selection of the neighbourhood with greatest combined score used for the LOLA criterion.
The entry LOLAVoronoi-DefaultVoronoiSamplingSize controls the sampling size used to estimate the Voronoi cells relative volume or generate new candidates.
The entry LOLAVoronoi-MaximumCombinationsNumber controls the maximum number of existing point subsets will be tested to get the best neighbourhood for the exploitation criterion.
The entry LOLAVoronoi-UseTruncatedDistribution controls the way the
distribution is truncated to the bounding box B of the Voronoi cell being sampled. If the flag is set to False, the sampling is done by a rejection method with respect to
and B. The advantage is to avoid the expensive computation of the normalization factor of the truncation of
. The drawback is that the acceptation rate might be low. If the flag is set to True, the truncated distribution of
to B is explicitly built and sampled. The advantage is to possibly use the CDF inversion method to sample this truncated distribution: all the points are accepted. But the CDF inversion method is only available if the copula of
is the independent one: otherwise a rejection method is used and the advantage of this option is lost. The drawback is the automatic computation of the normalization factor of the truncation of
which is used only if the CDF inversion method is used. As a result, the default value is False.
The string entry LOLAVoronoi-NonLinearityAggregationMethod controls how the non-linearity score is computed across multiple outputs from the gradient vectors: either Maximum (default) to distinguish the most nonlinear regions or Average that will smooth the score but can be a good alternative when there are only a few outputs.
The string entry LOLAVoronoi-DecompositionMethod selects the least-squares method to compute the gradient.
The float entry LOLAVoronoi-HybridScoreTradeoff is the value of the tradeoff coefficient
.
Examples
>>> import openturns as ot >>> import openturns.experimental as otexp >>> formula = '-4 * exp((-25 / 8) * (a0^2 + a1^2)) + 7 * exp((-125 / 4) * (a0^2 + a1^2))' >>> f1 = ot.SymbolicFunction(['a0', 'a1'], [formula]) >>> distribution = ot.JointDistribution([ot.Uniform(-1.0, 1.0)] * 2) >>> x0 = ot.LowDiscrepancyExperiment(ot.HaltonSequence(), distribution, 10).generate() >>> y0 = f1(x0) >>> algo = otexp.LOLAVoronoi(x0, y0, distribution)
Now add 2 blocks of 3 points:
>>> for i in range(2): ... x = algo.generate(3) ... y = f1(x) ... algo.update(x, y)
- __init__(*args)¶
- generate(size)¶
Generate a new sample.
- Parameters:
- sizeint
Size of sample to generate
- Returns:
- x
Sample
New input sample.
- x
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getGenerationIndices()¶
Accessor to the generation indices.
- Returns:
- generationIndices
Indices
Indices of last element for each generation. This is updated each time the update() method is evaluated.
- generationIndices
- getHybridScore()¶
Hybrid score accessor.
- Returns:
- hybridScore
Sample
The hybrid score
for the current sample.
- hybridScore
- getLOLAScore()¶
LOLA score accessor.
- Returns:
- lolaScore
Sample
The exploitation score
for the current sample. Note that unlike
this is scaled in
.
- lolaScore
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- getNeighbourhoodCandidatesNumber()¶
Neighbourhood candidates number accessor.
- Returns:
- neighbourhoodCandidatesNumberint
The number of extra closest neighbour around each reference point to consider for selection of the neighbourhood with greatest combined score used for the LOLA criterion. The default value is set to the LOLAVoronoi-DefaultNeighbourhoodCandidatesNumber entry from
ResourceMap
.
- getVoronoiSamplingSize()¶
Voronoi sampling size accessor.
- Returns:
- voronoiSamplingSizeint
The sampling size used to estimate the Voronoi cells relative volume or generate new candidates. The default value is set to the LOLAVoronoi-DefaultVoronoiSamplingSize entry from
ResourceMap
.
- getVoronoiScore()¶
Voronoi score accessor.
- Returns:
- voronoiScore
Sample
The exploration score
for the current sample.
- voronoiScore
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
- setNeighbourhoodCandidatesNumber(neighbourhoodCandidatesNumber)¶
Neighbourhood candidates number accessor.
- Parameters:
- neighbourhoodCandidatesNumberint
The number of extra closest neighbour around each reference point to consider for selection of the neighbourhood with greatest combined score used for the LOLA criterion. The default value is set to the LOLAVoronoi-DefaultNeighbourhoodCandidatesNumber entry from
ResourceMap
.
- setVoronoiSamplingSize(voronoiSamplingSize)¶
Voronoi sampling size accessor.
- Parameters:
- voronoiSamplingSizeint
The sampling size used to estimate the Voronoi cells relative volume or generate new candidates. The default value is set to the LOLAVoronoi-DefaultVoronoiSamplingSize entry from
ResourceMap
.