LeastSquaresStrategy¶

class
LeastSquaresStrategy
(*args)¶ Least squares strategy for the approximation coefficients.
 Available constructors:
LeastSquaresStrategy(weightedExp)
LeastSquaresStrategy(weightedExp, approxAlgoImpFact)
LeastSquaresStrategy(measure, approxAlgoImpFact)
LeastSquaresStrategy(measure, weightedExp, approxAlgoImpFact)
LeastSquaresStrategy(inputSample, outputSample, approxAlgoImpFact)
LeastSquaresStrategy(inputSample, weights, outputSample, approxAlgoImpFact)
 Parameters
 weightedExp
WeightedExperiment
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 classPenalizedLeastSquaresAlgorithmFactory
is used. measure
Distribution
Distribution with respect to which the basis is orthonormal. By default, the limit measure defined within the class
WeightedExperiment
is used. inputSample, outputSample2d sequence of float
The input random variables and the output samples 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 . If not precised, all weights are equals to , where is the size of the sample.
 weightedExp
Notes
This class is not usable because it has sense only within the
FunctionalChaosAlgorithm
: the least squares strategy evaluates the coefficients of the polynomials decomposition as follows:where .
The mean expectation is approximated by a relation of type:
where is a function defined as:
In the approximation of the mean expectation, the set I, the points and the weights are evaluated from methods implemented in the
WeightedExperiment
.Methods
getClassName
(self)Accessor to the object’s name.
getCoefficients
(self)Accessor to the coefficients.
getExperiment
(self)Accessor to the experiments.
getId
(self)Accessor to the object’s id.
getInputSample
(self)Accessor to the input sample.
getMeasure
(self)Accessor to the measure.
getName
(self)Accessor to the object’s name.
getOutputSample
(self)Accessor to the output sample.
getRelativeError
(self)Accessor to the relative error.
getResidual
(self)Accessor to the residual.
getShadowedId
(self)Accessor to the object’s shadowed id.
getVisibility
(self)Accessor to the object’s visibility state.
getWeights
(self)Accessor to the weights.
hasName
(self)Test if the object is named.
hasVisibleName
(self)Test if the object has a distinguishable name.
setExperiment
(self, weightedExperiment)Accessor to the design of experiment.
setInputSample
(self, inputSample)Accessor to the input sample.
setMeasure
(self, measure)Accessor to the measure.
setName
(self, name)Accessor to the object’s name.
setOutputSample
(self, outputSample)Accessor to the output sample.
setShadowedId
(self, id)Accessor to the object’s shadowed id.
setVisibility
(self, visible)Accessor to the object’s visibility state.
setWeights
(self, weights)Accessor to the weights.
computeCoefficients

__init__
(self, *args)¶ Initialize self. See help(type(self)) for accurate signature.

getClassName
(self)¶ Accessor to the object’s name.
 Returns
 class_namestr
The object class name (object.__class__.__name__).

getExperiment
(self)¶ Accessor to the experiments.
 Returns
 exp
WeightedExperiment
Weighted experiment used to evaluate the coefficients.
 exp

getId
(self)¶ Accessor to the object’s id.
 Returns
 idint
Internal unique identifier.

getMeasure
(self)¶ Accessor to the measure.
 Returns
 muDistribution
Measure defining the scalar product.

getName
(self)¶ Accessor to the object’s name.
 Returns
 namestr
The name of the object.

getRelativeError
(self)¶ Accessor to the relative error.
 Returns
 efloat
Relative error.

getResidual
(self)¶ Accessor to the residual.
 Returns
 erfloat
Residual error.

getShadowedId
(self)¶ Accessor to the object’s shadowed id.
 Returns
 idint
Internal unique identifier.

getVisibility
(self)¶ Accessor to the object’s visibility state.
 Returns
 visiblebool
Visibility flag.

hasName
(self)¶ Test if the object is named.
 Returns
 hasNamebool
True if the name is not empty.

hasVisibleName
(self)¶ Test if the object has a distinguishable name.
 Returns
 hasVisibleNamebool
True if the name is not empty and not the default one.

setExperiment
(self, weightedExperiment)¶ Accessor to the design of experiment.
 Parameters
 exp
WeightedExperiment
Weighted design of experiment.
 exp

setMeasure
(self, measure)¶ Accessor to the measure.
 Parameters
 mDistribution
Measure defining the scalar product.

setName
(self, name)¶ Accessor to the object’s name.
 Parameters
 namestr
The name of the object.

setOutputSample
(self, outputSample)¶ Accessor to the output sample.
 Parameters
 Y
Sample
Output Sample.
 Y

setShadowedId
(self, id)¶ Accessor to the object’s shadowed id.
 Parameters
 idint
Internal unique identifier.

setVisibility
(self, visible)¶ Accessor to the object’s visibility state.
 Parameters
 visiblebool
Visibility flag.