LinearModelResult¶
- class LinearModelResult(*args)¶
- Result of a LinearModelAlgorithm. - Parameters:
- inputSample2-d sequence of float
- The input sample of a model. 
- basisBasis
- Functional basis to estimate the trend. 
- designMatrix
- The design matrix - . 
- outputSample2-d sequence of float
- The output sample - . 
- metaModelFunction
- The meta model. 
- coefficientssequence of float
- The estimated coefficients - . 
- formulastr
- The formula description. 
- coefficientsNamessequence of str
- The coefficients names of the basis. 
- sampleResiduals2-d sequence of float
- The residual errors - . 
- standardizedSampleResiduals2-d sequence of float
- The standardized residuals defined in (9). 
- diagonalGramInversesequence of float
- The diagonal of the Gram inverse matrix. 
- leveragessequence of float
- The leverages - defined in (7). 
- cookDistancessequence of float
- Cook’s distances defined in (2). 
- residualsVariancefloat
- The unbiased variance estimator of the residuals defined in (8). 
 
 - Methods - Accessor to the least squares method. - Accessor to the Adjusted R-squared test. - getBasis()- Accessor to the basis. - Accessor to the object's name. - Accessor to the coefficients of the linear model. - Accessor to the coefficients names. - Accessor to the coefficients of standard error. - Accessor to the cook's distances. - Accessor to the degrees of freedom. - Accessor to the design matrix. - Accessor to the diagonal gram inverse matrix. - Accessor to the fitted sample. - Accessor to the formula. - Accessor to the input sample. - Accessor to the leverages. - Accessor to the metamodel. - getName()- Accessor to the object's name. - Accessor to the normal distribution of the residuals. - Accessor to the output sample. - Accessor to the R-squared test. - Accessor to the unbiased sample variance of the residuals. - Accessor to the residuals. - Accessor to the standardized residuals. - Returns if intercept is provided in the basis or not. - hasName()- Test if the object is named. - Get the model selection flag. - setInputSample(sampleX)- Accessor to the input sample. - setInvolvesModelSelection(involvesModelSelection)- Set the model selection flag. - setMetaModel(metaModel)- Accessor to the metamodel. - setName(name)- Accessor to the object's name. - setOutputSample(sampleY)- Accessor to the output sample. - getRelativeErrors - getResiduals - setRelativeErrors - setResiduals - See also - __init__(*args)¶
 - buildMethod()¶
- Accessor to the least squares method. - Returns:
- leastSquaresMethod: LeastSquaresMethod
- The least squares method. 
 
- leastSquaresMethod: 
 - Notes - The least squares method used to estimate the coefficients is precised in the - ResourceMapclass, entry LinearModelAlgorithm-DecompositionMethod.
 - getAdjustedRSquared()¶
- Accessor to the Adjusted R-squared test. - Returns:
- adjustedRSquaredfloat
- The - indicator. 
 
 - Notes - The - value quantifies the quality of the linear approximation. With respect to - , - takes into account the data set size and the number of hyperparameters. - If the model is defined by (3) such that the basis does not contain any intercept (constant function), then - is defined by: - where - is the degrees of freedom of the model defined in (4) and - the number of experiences. - Otherwise, when the model is defined by (1) or by (3) with an intercept, - is defined by: - where - is defined in (3) or (4). - If the degree of freedom - is null, - is not defined. 
 - getBasis()¶
- Accessor to the basis. - Returns:
- basisBasis
- The basis of the regression model. 
 
- basis
 - Notes - If a functional basis has been provided in the constructor, then we get it back: - . Its size is - . - Otherwise, the functional basis is composed of the projections - such that - for - , completed with the constant function: - . Its size is - . 
 - getClassName()¶
- Accessor to the object’s name. - Returns:
- class_namestr
- The object class name (object.__class__.__name__). 
 
 
 - getCoefficients()¶
- Accessor to the coefficients of the linear model. - Returns:
- coefficientsPoint
- The estimated of the coefficients - . 
 
- coefficients
 
 - getCoefficientsNames()¶
- Accessor to the coefficients names. - Returns:
- coefficientsNamesDescription
 
- coefficientsNames
 - Notes - The name of the coefficient - is the name of the regressor - . 
 - getCoefficientsStandardErrors()¶
- Accessor to the coefficients of standard error. - Returns:
- standardErrorsPoint
 
- standardErrors
 - Notes - The standard deviation - of the estimator - is defined by: - (1)¶ - where: 
 - getCookDistances()¶
- Accessor to the cook’s distances. - Returns:
- cookDistancesPoint
- The Cook’s distance of each experience - . 
 
- cookDistances
 - Notes - The Cook’s distance measures the impact of every experience on the linear regression. See [rawlings2001] (section 11.2.1, Cook’s D page 362) for more details. - The Cook distance of experience - is defined by: - (2)¶ - where - is the standardized residual defined in (9) and - is the degress of freedom defined in (3) or (4). 
 - getDegreesOfFreedom()¶
- Accessor to the degrees of freedom. - Returns:
- dofint, 
- Number of degrees of freedom. 
 
- dofint, 
 - Notes - If the linear model is defined by (1), the degrees of freedom - is: - (3)¶ - where - is the number of regressors. - Otherwise, the linear model is defined by (3) and its - is: - (4)¶ - where - is the number of functions in the provided basis. 
 - getDesign()¶
- Accessor to the design matrix. - Returns:
- design: Matrix
- The design matrix - . 
 
- design: 
 - Notes - If the linear model is defined by (1), the design matrix is: - (5)¶ - where - and - is the values of the regressor - in the - experiences. Thus, - has - rows and - columns. - If the linear model is defined by (3), the design matrix is: - (6)¶ - where - is the values of the function - at the - experiences. Thus, - has - rows and - columns. 
 - getDiagonalGramInverse()¶
- Accessor to the diagonal gram inverse matrix. - Returns:
- diagonalGramInversePoint
- The diagonal of the Gram inverse matrix. 
 
- diagonalGramInverse
 - Notes - The Gram matrix is - where - is the design matrix defined in (5) or (6). 
 - getFormula()¶
- Accessor to the formula. - Returns:
- condensedFormulastr
 
 - Notes - This formula gives access to the linear model. 
 - getLeverages()¶
- Accessor to the leverages. - Returns:
- leveragesPoint
- The leverage of all the experiences - . 
 
- leverages
 - Notes - We denote by - the fitted values of the - experiences. Then we have: - where - is the design matrix defined in (5). It leads to: - where: - Thus, for the experience - , we get: - (7)¶ - where - is the - -th element of the diagonal of - : - is the leverage - of experience - . 
 - getName()¶
- Accessor to the object’s name. - Returns:
- namestr
- The name of the object. 
 
 
 - getNoiseDistribution()¶
- Accessor to the normal distribution of the residuals. - Returns:
- noiseDistributionNormal
- The normal distribution estimated from the residuals. 
 
- noiseDistribution
 - Notes - The noise distribution is the distribution of the residuals. It is assumed to be Gaussian. The normal distribution has zero mean and its variance is estimated from the residuals sample - defined in (5), using the unbiaised estimator defined in (8). - If the residuals are not Gaussian, this distribution is not appropriate and should not be used. 
 - getRSquared()¶
- Accessor to the R-squared test. - Returns:
- rSquaredfloat
- The indicator - . 
 
 - Notes - The - value quantifies the quality of the linear approximation. - If the model is defined by (3) such that the basis does not contain any intercept (constant function), then - is defined by: - where the - are the residuals defined in (5) and - the output sample values. - Otherwise, when the model is defined by (1) or by (3) with an intercept, - is defined by: - where - . 
 - getResidualsVariance()¶
- Accessor to the unbiased sample variance of the residuals. - Returns:
- residualsVariancefloat
- The residuals variance estimator. 
 
 - Notes - The residual variance estimator is the unbiaised empirical variance of the residuals: - (8)¶ - where - is the degrees of freedom of the model defined in (3) or (4). 
 - getSampleResiduals()¶
- Accessor to the residuals. - Returns:
- sampleResidualsSample
- The sample of the residuals. 
 
- sampleResiduals
 - Notes - The residuals sample is - defined in (5). 
 - getStandardizedResiduals()¶
- Accessor to the standardized residuals. - Returns:
- standardizedResidualsSample
- The standarduzed residuals - . 
 
- standardizedResiduals
 - Notes - The standardized residuals are defined by: - (9)¶ - where - is the unbiaised residuals variance defined in (8) and - is the leverage of experience - defined in (7). 
 - hasIntercept()¶
- Returns if intercept is provided in the basis or not. - Returns:
- interceptBool
- Tells if the model has a constant regressor. 
 
 - Notes - The intercept is True when: 
 - hasName()¶
- Test if the object is named. - Returns:
- hasNamebool
- True if the name is not empty. 
 
 
 - involvesModelSelection()¶
- Get the model selection flag. - A model selection method can be used to select the coefficients to best predict the output. Model selection can lead to a sparse model. - Returns:
- involvesModelSelectionbool
- True if the method involves a model selection method. 
 
 
 - setInputSample(sampleX)¶
- Accessor to the input sample. - Parameters:
- inputSampleSample
- The input sample. 
 
- inputSample
 
 - setInvolvesModelSelection(involvesModelSelection)¶
- Set the model selection flag. - A model selection method can be used to select the coefficients to best predict the output. Model selection can lead to a sparse model. - Parameters:
- involvesModelSelectionbool
- True if the method involves a model selection method. 
 
 
 - setName(name)¶
- Accessor to the object’s name. - Parameters:
- namestr
- The name of the object. 
 
 
 
 OpenTURNS
      OpenTURNS