IntegrationExpansion¶
- class IntegrationExpansion(*args)¶
L2 approximation on an orthonormal basis using integration strategy and a fixed basis.
- Available constructors:
IntegrationExpansion(inputSample, outputSample, distribution)
IntegrationExpansion(inputSample, weights, outputSample, distribution)
IntegrationExpansion(inputSample, outputSample, distribution, basis, basisSize)
IntegrationExpansion(inputSample, weights, outputSample, distribution, basis, basisSize)
IntegrationExpansion(inputSample, outputSample, distribution, basis, basisSize, activeFunctions)
IntegrationExpansion(inputSample, weights, outputSample, distribution, basis, basisSize, activeFunctions)
- Parameters:
- inputSample2-d sequence of float of size
Input sample.
- weightsequence of float of size
, optional
Input weights. By default, a uniform weight equals to
is used.
- outputSample2-d sequence of floats of size
Output sample.
- distribution
Distribution The distribution associated to the weighted sample (inputSample, weights)
- basis
OrthogonalBasis, optional The orthonormal basis of the vector space on which the approximation is built. By default, a basis is built using an hyperbolic enumerate function
HyperbolicAnisotropicEnumerateFunctionassociated to thenorm specified by the
FunctionalChaosAlgorithm-QNormkey inResourceMap. The basis is obtained through a tensorization of the univariate orthonormal polynomial bases associated to each marginal distributions of distribution.- basisSizeint, optional
The size of the basis on which the approximation is built. If not given, it is given by the
FunctionalChaosAlgorithm-BasisSizekey inResourceMapif this value is positive, or as the cardinal of the set of basis functions up to a degree given by theFunctionalChaosAlgorithm-MaximumTotalDegreekey inResourceMap.- activeFunctionssequence of int, optional
The indices of the basis functions to use for the approximation. If not given, all functions from 0 to basisSize-1 are used. Must be non-empty and all indices must be less than basisSize.
- inputSample2-d sequence of float of size
Methods
BuildDistribution(inputSample)Recover the distribution, with metamodel performance in mind.
Accessor to the active functions in the basis.
Get the adaptive strategy.
Accessor to the object's name.
Accessor to the joint probability density function of the physical input vector.
Accessor to the input sample.
Get the maximum residual.
getName()Accessor to the object's name.
Accessor to the output sample.
Get the projection strategy.
Get the results of the metamodel computation.
Transformation method flag accessor.
Return the weights of the input sample.
hasName()Test if the object is named.
run()Compute the metamodel.
setActiveFunctions(activeFunctions)Accessor to the active functions in the basis.
setDistribution(distribution)Accessor to the joint probability density function of the physical input vector.
setMaximumResidual(residual)Set the maximum residual.
setName(name)Accessor to the object's name.
setProjectionStrategy(projectionStrategy)Set the projection strategy.
setUseTransformation(useTransformation)Transformation method flag accessor.
Notes
This class is used in the functional chaos expansion context implemented in the class
FunctionalChaosAlgorithm.This class enables to estimate a functional chaos expansion defined in Functional Chaos Expansion by equation (5) with no model selection: the model is approximated in the specified functional space generated by the specified basis, and the coefficients
are computed using the inner product defined by the specified distribution.
This computation makes sense if and only if the specified basis is orthonormal with respect to the distribution. When the basis is not specified, it is built as the tensorization of the univariate orthonormal polynomial bases associated to each marginal of distribution: it implies that the basis is orthogonal to the input distribution only in case of independent components.
Examples
Solves a functional least-squares approximation using a projection on an orthonormal basis:
>>> import openturns as ot >>> g = ot.SymbolicFunction('x', 'sin(x)') >>> distribution = ot.Uniform(-2.0, 2.0) >>> inSample = distribution.getSample(10) >>> outSample = g(inSample) >>> basis = ot.OrthogonalProductPolynomialFactory([ot.LegendreFactory()]) >>> basisSize = 5 >>> algo = ot.IntegrationExpansion(inSample, outSample, distribution, basis, basisSize) >>> algo.run()
- __init__(*args)¶
- static BuildDistribution(inputSample)¶
Recover the distribution, with metamodel performance in mind.
For each marginal, find the best 1-d continuous parametric model else fallback to the use of a nonparametric one.
The selection is done as follow:
We start with a list of all parametric models (all factories)
For each model, we estimate its parameters if feasible.
We check then if model is valid, ie if its Kolmogorov score exceeds a threshold fixed in the MetaModelAlgorithm-PValueThreshold ResourceMap key. Default value is 5%
We sort all valid models and return the one with the optimal criterion.
For the last step, the criterion might be BIC, AIC or AICC. The specification of the criterion is done through the MetaModelAlgorithm-ModelSelectionCriterion ResourceMap key. Default value is fixed to BIC. Note that if there is no valid candidate, we estimate a non-parametric model (
KernelSmoothingorHistogram). The MetaModelAlgorithm-NonParametricModel ResourceMap key allows selecting the preferred one. Default value is HistogramOne each marginal is estimated, we use the Spearman independence test on each component pair to decide whether an independent copula. In case of non independence, we rely on a
NormalCopula.- Parameters:
- sample
Sample Input sample.
- sample
- Returns:
- distribution
Distribution Input distribution.
- distribution
- getActiveFunctions()¶
Accessor to the active functions in the basis.
- Returns:
- activeFunctionssequence of int
The indices of the functions used for the approximation in the basis.
- getAdaptiveStrategy()¶
Get the adaptive strategy.
- Returns:
- adaptiveStrategy
AdaptiveStrategy Strategy of selection of the different terms of the multivariate basis.
- adaptiveStrategy
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getDistribution()¶
Accessor to the joint probability density function of the physical input vector.
- Returns:
- distribution
Distribution Joint probability density function of the physical input vector.
- distribution
- getInputSample()¶
Accessor to the input sample.
- Returns:
- inputSample
Sample Input sample of a model evaluated apart.
- inputSample
- getMaximumResidual()¶
Get the maximum residual.
- Returns:
- residualfloat
Residual value needed in the projection strategy.
Default value is
.
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- getOutputSample()¶
Accessor to the output sample.
- Returns:
- outputSample
Sample Output sample of a model evaluated apart.
- outputSample
- getProjectionStrategy()¶
Get the projection strategy.
- Returns:
- strategy
ProjectionStrategy Projection strategy.
- strategy
Notes
The projection strategy selects the different terms of the multivariate basis to define the subset K.
- getResult()¶
Get the results of the metamodel computation.
- Returns:
- result
FunctionalChaosResult Result structure, created by the method
run().
- result
- getUseTransformation()¶
Transformation method flag accessor.
- Returns:
- useTransformationbool
Whether the transformation method is used.
Notes
The transformation method consists in using an isoprobabilistic transformation that maps the input distribution to the measure of the orthogonal basis. The basis is orthonormal with respect to the measure, and Sobol’ indices can be computed.
- getWeights()¶
Return the weights of the input sample.
- Returns:
- weightssequence of float
The weights of the points in the input sample.
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- run()¶
Compute the metamodel.
Notes
Evaluates the metamodel and stores all the results in a result structure.
- setActiveFunctions(activeFunctions)¶
Accessor to the active functions in the basis.
- Parameters:
- activeFunctionssequence of int
The indices of the functions used for the approximation in the basis.
- setDistribution(distribution)¶
Accessor to the joint probability density function of the physical input vector.
- Parameters:
- distribution
Distribution Joint probability density function of the physical input vector.
- distribution
- setMaximumResidual(residual)¶
Set the maximum residual.
- Parameters:
- residualfloat
Residual value needed in the projection strategy.
Default value is
.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
- setProjectionStrategy(projectionStrategy)¶
Set the projection strategy.
- Parameters:
- projectionStrategy
ProjectionStrategy Strategy to estimate the coefficients
.
- projectionStrategy
- setUseTransformation(useTransformation)¶
Transformation method flag accessor.
- Parameters:
- useTransformationbool
Whether to use the transformation method.
Notes
The transformation method consists in using an isoprobabilistic transformation that maps the input distribution to the measure of the orthogonal basis. The basis is orthonormal with respect to the measure, and Sobol’ indices can be computed.
OpenTURNS