LeastSquaresStrategy

class LeastSquaresStrategy(*args)

Least squares strategy for the approximation coefficients.

Available constructors:

LeastSquaresStrategy(weightedExp)

LeastSquaresStrategy(weightedExp, approxAlgoImpFact)

LeastSquaresStrategy(approxAlgoImpFact)

LeastSquaresStrategy(measure, approxAlgoImpFact)

LeastSquaresStrategy(measure, weightedExp, approxAlgoImpFact)

LeastSquaresStrategy(inputSample, outputSample, approxAlgoImpFact)

LeastSquaresStrategy(inputSample, weights, outputSample, approxAlgoImpFact)

Parameters:
weightedExpWeightedExperiment

Experimental design used for the transformed input data. By default the class MonteCarloExperiment is used.

approxAlgoImpFactApproximationAlgorithmImplementationFactory

The factory that builds the desired ApproximationAlgorithm. By default the class PenalizedLeastSquaresAlgorithmFactory is used.

measureDistribution

Distribution \mu with respect to which the basis is orthonormal. By default, the limit measure defined within the class WeightedExperiment is used.

inputSample, outputSample2-d sequence of float

The input random variables \vect{X}=(X_1, \dots, X_{n_X})^T and the output samples \vect{Y} that describe the model.

weightssequence of float

Numerical point that are the weights associated to the input sample points such that the corresponding weighted experiment is a good approximation of \mu. If not precised, all weights are equals to \omega_i = \frac{1}{size}, where size is the size of the sample.

Notes

This class is not usable because it has sense only within the FunctionalChaosAlgorithm : the least squares strategy evaluates the coefficients (a_k)_{k \in K} of the polynomials decomposition as follows:

\vect{a} = \argmin_{\vect{b} \in \Rset^P} E_{\mu} \left[ \left( g \circ T^{-1}
        (\vect{U}) - \vect{b}^{\intercal} \vect{\Psi}(\vect{U}) \right)^2 \right]

where \vect{U} = T(\vect{X}).

The mean expectation E_{\mu} is approximated by a relation of type:

E_{\mu} \left[ f(\vect{U}) \right] \approx \sum_{i \in I} \omega_i f(\Xi_i)

where is a function L_1(\mu) defined as:

f(\vect{U} = \left( g \circ T^{-1} (\vect{U}) - \vect{b}^{\intercal}
                             \vect{\Psi}(\vect{U}) \right)^2

In the approximation of the mean expectation, the set I, the points (\Xi_i)_{i \in I} and the weights (\omega_i)_{i \in I} are evaluated from methods implemented in the WeightedExperiment.

Methods

getClassName()

Accessor to the object's name.

getCoefficients()

Accessor to the coefficients.

getExperiment()

Accessor to the experiments.

getId()

Accessor to the object's id.

getInputSample()

Accessor to the input sample.

getMeasure()

Accessor to the measure.

getName()

Accessor to the object's name.

getOutputSample()

Accessor to the output sample.

getRelativeError()

Accessor to the relative error.

getResidual()

Accessor to the residual.

getShadowedId()

Accessor to the object's shadowed id.

getVisibility()

Accessor to the object's visibility state.

getWeights()

Accessor to the weights.

hasName()

Test if the object is named.

hasVisibleName()

Test if the object has a distinguishable name.

setExperiment(weightedExperiment)

Accessor to the design of experiment.

setInputSample(inputSample)

Accessor to the input sample.

setMeasure(measure)

Accessor to the measure.

setName(name)

Accessor to the object's name.

setOutputSample(outputSample)

Accessor to the output sample.

setShadowedId(id)

Accessor to the object's shadowed id.

setVisibility(visible)

Accessor to the object's visibility state.

setWeights(weights)

Accessor to the weights.

__init__(*args)
getClassName()

Accessor to the object’s name.

Returns:
class_namestr

The object class name (object.__class__.__name__).

getCoefficients()

Accessor to the coefficients.

Returns:
coefPoint

Coefficients (\alpha_k)_{k \in K}.

getExperiment()

Accessor to the experiments.

Returns:
expWeightedExperiment

Weighted experiment used to evaluate the coefficients.

getId()

Accessor to the object’s id.

Returns:
idint

Internal unique identifier.

getInputSample()

Accessor to the input sample.

Returns:
XSample

Input Sample.

getMeasure()

Accessor to the measure.

Returns:
muDistribution

Measure \mu defining the scalar product.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getOutputSample()

Accessor to the output sample.

Returns:
YSample

Output Sample.

getRelativeError()

Accessor to the relative error.

Returns:
efloat

Relative error.

getResidual()

Accessor to the residual.

Returns:
erfloat

Residual error.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:
idint

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns:
visiblebool

Visibility flag.

getWeights()

Accessor to the weights.

Returns:
wPoint

Weights of the design of experiments.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:
hasVisibleNamebool

True if the name is not empty and not the default one.

setExperiment(weightedExperiment)

Accessor to the design of experiment.

Parameters:
expWeightedExperiment

Weighted design of experiment.

setInputSample(inputSample)

Accessor to the input sample.

Parameters:
XSample

Input Sample.

setMeasure(measure)

Accessor to the measure.

Parameters:
mDistribution

Measure \mu defining the scalar product.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

setOutputSample(outputSample)

Accessor to the output sample.

Parameters:
YSample

Output Sample.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:
idint

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:
visiblebool

Visibility flag.

setWeights(weights)

Accessor to the weights.

Parameters:
wPoint

Weights of the design of experiments.

Examples using the class

Polynomial chaos over database

Polynomial chaos over database

Compute grouped indices for the Ishigami function

Compute grouped indices for the Ishigami function

Validate a polynomial chaos

Validate a polynomial chaos

Advanced polynomial chaos construction

Advanced polynomial chaos construction

Create a polynomial chaos for the Ishigami function: a quick start guide to polynomial chaos

Create a polynomial chaos for the Ishigami function: a quick start guide to polynomial chaos

Polynomial chaos expansion cross-validation

Polynomial chaos expansion cross-validation

Polynomial chaos is sensitive to the degree

Polynomial chaos is sensitive to the degree

Compute Sobol’ indices confidence intervals

Compute Sobol' indices confidence intervals

Metamodel of a field function

Metamodel of a field function

Compute leave-one-out error of a polynomial chaos expansion

Compute leave-one-out error of a polynomial chaos expansion