GeneralLinearModelResult

class GeneralLinearModelResult(*args)

General linear model result.

Available constructors:

GeneralLinearModelResult(inputSample, outputSample, metaModel, residuals, relativeErrors, basis, trendCoefficients, covarianceModel, optimalLogLikelihood)

GeneralLinearModelResult(inputSample, outputSample, metaModel, residuals, relativeErrors, basis, trendCoefficients, covarianceModel, covarianceCholeskyFactor, covarianceHMatrix, optimalLogLikelihood)

Parameters
inputSample, outputSampleSample

The samples (\vect{x}_k)_{1 \leq k \leq N} \in \Rset^d and (\vect{y}_k)_{1 \leq k \leq N}\in \Rset^p.

metaModelFunction

The meta model: \tilde{\cM}: \Rset^d \rightarrow \Rset^p, defined in :eq:metaModel.

residualsPoint

The residual errors.

relativeErrorsPoint

The relative errors.

basiscollection of Basis

Collection of the p functional basis: (\varphi_j^l: \Rset^d \rightarrow \Rset)_{1 \leq j \leq n_l} for each l \in [1, p]. Its size should be equal to zero if the trend is not estimated.

trendCoefficientscollection of Point

The trend coefficients vectors (\vect{\alpha}^1, \dots, \vect{\alpha}^p).

covarianceModelCovarianceModel

Covariance function of the Gaussian process with its optimized parameters.

covarianceCholeskyFactorTriangularMatrix

The Cholesky factor \mat{L} of \mat{C}.

covarianceHMatrixHMatrix

The hmat implementation of \mat{L}.

optimalLogLikelihoodfloat

The maximum log-likelihood corresponding to the model.

Notes

The structure is usually created by the method run() of a GeneralLinearModelAlgorithm, and obtained thanks to the getResult() method.

The meta model \tilde{\cM}: \Rset^d \rightarrow \Rset^p is defined by:

(1)\tilde{\cM}(\vect{x}) = \left(
  \begin{array}{l}
    \mu_1(\vect{x}) \\
    \dots  \\
    \mu_p(\vect{x}) 
   \end{array}
 \right)

where \mu_l(\vect{x}) = \sum_{j=1}^{n_l} \alpha_j^l \varphi_j^l(\vect{x}) and \varphi_j^l: \Rset^d \rightarrow \Rset are the trend functions.

If a normalizing transformation T has been used, the meta model is built on the inputs \vect{z}_k = T(\vect{x}_k) and the meta model writes:

(2)\tilde{\cM}(\vect{x}) = \left(
  \begin{array}{l}
    \mu_1\circ T(\vect{x}) \\
    \dots  \\
    \mu_p\circ T(\vect{x}) 
   \end{array}
 \right)

Examples

Create the model \cM: \Rset \mapsto \Rset and the samples:

>>> import openturns as ot
>>> f = ot.SymbolicFunction(['x'],  ['x * sin(x)'])
>>> sampleX = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0]]
>>> sampleY = f(sampleX)

Create the algorithm:

>>> basis = ot.Basis([ot.SymbolicFunction(['x'], ['x']), ot.SymbolicFunction(['x'], ['x^2'])])
>>> covarianceModel = ot.GeneralizedExponential([2.0], 2.0)
>>> algo = ot.GeneralLinearModelAlgorithm(sampleX, sampleY, covarianceModel, basis)
>>> algo.run()

Get the result:

>>> result = algo.getResult()

Get the meta model:

>>> metaModel = result.getMetaModel()
>>> graph = metaModel.draw(0.0, 7.0)
>>> cloud = ot.Cloud(sampleX, sampleY)
>>> cloud.setPointStyle('fcircle')
>>> graph = ot.Graph()
>>> graph.add(cloud)
>>> graph.add(f.draw(0.0, 7.0))
>>> graph.setColors(['black', 'blue', 'red'])

Methods

getBasisCollection(self)

Accessor to the collection of basis.

getClassName(self)

Accessor to the object’s name.

getCovarianceModel(self)

Accessor to the covariance model.

getId(self)

Accessor to the object’s id.

getMetaModel(self)

Accessor to the metamodel.

getModel(self)

Accessor to the model.

getName(self)

Accessor to the object’s name.

getNoise(self)

Accessor to the Gaussian process.

getOptimalLogLikelihood(self)

Accessor to the optimal log-likelihood of the model.

getRelativeErrors(self)

Accessor to the relative errors.

getResiduals(self)

Accessor to the residuals.

getShadowedId(self)

Accessor to the object’s shadowed id.

getTransformation(self)

Accessor to the normalizing transformation.

getTrendCoefficients(self)

Accessor to the trend coefficients.

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

setMetaModel(self, metaModel)

Accessor to the metamodel.

setModel(self, model)

Accessor to the model.

setName(self, name)

Accessor to the object’s name.

setRelativeErrors(self, relativeErrors)

Accessor to the relative errors.

setResiduals(self, residuals)

Accessor to the residuals.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setTransformation(self, transformation)

Set accessor to the normalizing transformation.

setVisibility(self, visible)

Accessor to the object’s visibility state.

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

getBasisCollection(self)

Accessor to the collection of basis.

Returns
basisCollectioncollection of Basis

Collection of the p function basis: (\varphi_j^l: \Rset^d \rightarrow \Rset)_{1 \leq j \leq n_l} for each l \in [1, p].

Notes

If the trend is not estimated, the collection is empty.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

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

getCovarianceModel(self)

Accessor to the covariance model.

Returns
covModelCovarianceModel

The covariance model of the Gaussian process W.

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getMetaModel(self)

Accessor to the metamodel.

Returns
metaModelFunction

Metamodel.

getModel(self)

Accessor to the model.

Returns
modelFunction

Physical model approximated by a metamodel.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getNoise(self)

Accessor to the Gaussian process.

Returns
processProcess

Returns the Gaussian process W with the optimized parameters.

getOptimalLogLikelihood(self)

Accessor to the optimal log-likelihood of the model.

Returns
optimalLogLikelihoodfloat

The value of the log-likelihood corresponding to the model.

getRelativeErrors(self)

Accessor to the relative errors.

Returns
relativeErrorsPoint

The relative errors defined as follows for each output of the model: \displaystyle \frac{\sum_{i=1}^N (y_i - \hat{y_i})^2}{N \Var{\vect{Y}}} with \vect{Y} the vector of the N model’s values y_i and \hat{y_i} the metamodel’s values.

getResiduals(self)

Accessor to the residuals.

Returns
residualsPoint

The residual values defined as follows for each output of the model: \displaystyle \frac{\sqrt{\sum_{i=1}^N (y_i - \hat{y_i})^2}}{N} with y_i the N model’s values and \hat{y_i} the metamodel’s values.

getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getTransformation(self)

Accessor to the normalizing transformation.

Returns
transformationFunction

The transformation T that normalizes the input sample.

getTrendCoefficients(self)

Accessor to the trend coefficients.

Returns
trendCoefcollection of Point

The trend coefficients vectors (\vect{\alpha}^1, \dots, \vect{\alpha}^p)

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.

setMetaModel(self, metaModel)

Accessor to the metamodel.

Parameters
metaModelFunction

Metamodel.

setModel(self, model)

Accessor to the model.

Parameters
modelFunction

Physical model approximated by a metamodel.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setRelativeErrors(self, relativeErrors)

Accessor to the relative errors.

Parameters
relativeErrorssequence of float

The relative errors defined as follows for each output of the model: \displaystyle \frac{\sum_{i=1}^N (y_i - \hat{y_i})^2}{N \Var{\vect{Y}}} with \vect{Y} the vector of the N model’s values y_i and \hat{y_i} the metamodel’s values.

setResiduals(self, residuals)

Accessor to the residuals.

Parameters
residualssequence of float

The residual values defined as follows for each output of the model: \displaystyle \frac{\sqrt{\sum_{i=1}^N (y_i - \hat{y_i})^2}}{N} with y_i the N model’s values and \hat{y_i} the metamodel’s values.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setTransformation(self, transformation)

Set accessor to the normalizing transformation.

Parameters
transformationFunction

The transformation T that normalizes the input sample.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.