LinearLeastSquares¶
- class LinearLeastSquares(*args)¶
First order polynomial response surface by least squares.
- Parameters:
- dataIn2-d sequence of float
Input data.
- dataOut2-d sequence of float
Output data.`.
Methods
Get the centering vector of the approximation.
Accessor to the object's name.
Get the constant vector of the approximation.
Get the input data.
Get the linear matrix of the approximation.
getName()Accessor to the object's name.
Get the output data.
Get the meta model result class.
hasName()Test if the object is named.
run()Perform the least squares approximation.
setDataOut(dataOut)Set the output data.
setName(name)Accessor to the object's name.
getDataIn
getDataOut
getMetaModel
See also
Notes
A least squares meta model provides an approximation of the model which is valid over its whole domain of definition.
This class estimates the meta model
defined by:
(1)¶
from an experimental design
of size
, that is, a set of observations of the input vector defined by:
(2)¶
and the corresponding output vectors:
(3)¶
where
.
Refer to Least squares meta models to get details on general least squares meta models and to get information on the estimation of the matrix
, the center vector
and the constant vector
.
Examples
>>> import openturns as ot >>> formulas = ['cos(x1 + x2)', '(x2 + 1) * exp(x1 - 2 * x2)'] >>> f = ot.SymbolicFunction(['x1', 'x2'], formulas) >>> X = [[0.5,0.5], [-0.5,-0.5], [-0.5,0.5], [0.5,-0.5]] >>> X += [[0.25,0.25], [-0.25,-0.25], [-0.25,0.25], [0.25,-0.25]] >>> Y = f(X) >>> algo = ot.LinearLeastSquares(X, Y) >>> algo.run() >>> mm = algo.getResult().getMetaModel() >>> x = [0.1, 0.1] >>> y = mm(x)
- __init__(*args)¶
- getCenter()¶
Get the centering vector of the approximation.
- Returns:
- centerVector
Point Centering vector of the approximation, equal to
.
- centerVector
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getConstant()¶
Get the constant vector of the approximation.
- Returns:
- constantVector
Point Constant vector
.
- constantVector
Notes
The constant vector
is defined in (1).
- getInputSample()¶
Get the input data.
- Returns:
- dataIn
Sample Input data.
- dataIn
Notes
The input experimental design is defined in (2).
- getLinear()¶
Get the linear matrix of the approximation.
- Returns:
- linearMatrix
Matrix Linear matrix
.
- linearMatrix
Notes
The linear matrix
is defined in (1).
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- getOutputSample()¶
Get the output data.
- Returns:
- dataOut
Sample Output data.
- dataOut
Notes
The output experimental design is defined in (3).
- getResult()¶
Get the meta model result class.
- Returns:
- result
MetaModelResult The class that contains all the results on the meta model.
- result
Notes
To get the meta model
defined in (1) as a
Function, use thegetMetaModel()method.
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- run()¶
Perform the least squares approximation.
- setDataOut(dataOut)¶
Set the output data.
- Parameters:
- dataOut2-d sequence of float
Output data.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
OpenTURNS