1%define OT_LeastSquaresMethod_doc 2"Base class for least square solvers. 3 4Available constructors: 5 LeastSquaresMethod(*proxy, weight, indices*) 6 7 LeastSquaresMethod(*proxy, indices*) 8 9 LeastSquaresMethod(*design*) 10 11Parameters 12---------- 13proxy : :class:`~openturns.DesignProxy` 14 Input sample 15weight : sequence of float 16 Output weights 17indices : sequence of int 18 Indices allowed in the basis 19design : 2-d sequence of float 20 A priori known design matrix 21 22See also 23-------- 24CholeskyMethod, SVDMethod, QRMethod 25 26Notes 27----- 28Solve the least-squares problem: 29 30.. math:: 31 32 \vect{a} = \argmin_{\vect{b} \in \Rset^P} ||y - \vect{b}^{\intercal} \vect{\Psi}(\vect{U})||^2 33" 34%enddef 35%feature("docstring") OT::LeastSquaresMethodImplementation 36OT_LeastSquaresMethod_doc 37 38// --------------------------------------------------------------------- 39 40%define OT_LeastSquaresMethod_getInputSample_doc 41"Input sample accessor. 42 43Returns 44------- 45inputSample : :class:`~openturns.Sample` 46 Input sample." 47%enddef 48%feature("docstring") OT::LeastSquaresMethodImplementation::getInputSample 49OT_LeastSquaresMethod_getInputSample_doc 50 51// --------------------------------------------------------------------- 52 53%define OT_LeastSquaresMethod_getWeight_doc 54"Accessor to the weights. 55 56Returns 57------- 58weight : :class:`~openturns.Point` 59 Weights." 60%enddef 61%feature("docstring") OT::LeastSquaresMethodImplementation::getWeight 62OT_LeastSquaresMethod_getWeight_doc 63 64// --------------------------------------------------------------------- 65 66%define OT_LeastSquaresMethod_getBasis_doc 67"Accessor to the basis. 68 69Returns 70------- 71basis : collection of :class:`~openturns.Function` 72 Basis." 73%enddef 74%feature("docstring") OT::LeastSquaresMethodImplementation::getBasis 75OT_LeastSquaresMethod_getBasis_doc 76 77// --------------------------------------------------------------------- 78 79%define OT_LeastSquaresMethod_getCurrentIndices_doc 80"Current indices accessor. 81 82Returns 83------- 84indices : :class:`~openturns.Indices` 85 Indices of the current decomposition in the global basis." 86%enddef 87%feature("docstring") OT::LeastSquaresMethodImplementation::getCurrentIndices 88OT_LeastSquaresMethod_getCurrentIndices_doc 89 90// --------------------------------------------------------------------- 91 92%define OT_LeastSquaresMethod_getInitialIndices_doc 93"Initial indices accessor. 94 95Returns 96------- 97indices : :class:`~openturns.Indices` 98 Initial indices of the terms in the global basis." 99%enddef 100%feature("docstring") OT::LeastSquaresMethodImplementation::getInitialIndices 101OT_LeastSquaresMethod_getInitialIndices_doc 102 103// --------------------------------------------------------------------- 104 105%define OT_LeastSquaresMethod_solve_doc 106"Solve the least-squares problem. 107 108.. math:: 109 110 \vect{a} = \argmin_{\vect{x} \in \Rset^P} ||M\vect{x}-\vect{b}||^2 111 112Parameters 113---------- 114b : sequence of float 115 Second term of the equation 116 117Returns 118------- 119a : :class:`~openturns.Point` 120 The solution." 121%enddef 122%feature("docstring") OT::LeastSquaresMethodImplementation::solve 123OT_LeastSquaresMethod_solve_doc 124 125// --------------------------------------------------------------------- 126 127%define OT_LeastSquaresMethod_solveNormal_doc 128"Solve the least-squares problem using normal equation. 129 130.. math:: 131 132 M^T*M*x=M^T*b 133 134Parameters 135---------- 136b : sequence of float 137 Second term of the equation 138 139Returns 140------- 141x : :class:`~openturns.Point` 142 The solution." 143%enddef 144%feature("docstring") OT::LeastSquaresMethodImplementation::solveNormal 145OT_LeastSquaresMethod_solveNormal_doc 146 147// --------------------------------------------------------------------- 148 149%define OT_LeastSquaresMethod_getGramInverse_doc 150"Get the inverse Gram matrix of input sample. 151 152.. math:: 153 154 G^{-1} = (X^T * X)^{-1} 155 156Returns 157------- 158c : :class:`~openturns.CovarianceMatrix` 159 The inverse Gram matrix." 160%enddef 161%feature("docstring") OT::LeastSquaresMethodImplementation::getGramInverse 162OT_LeastSquaresMethod_getGramInverse_doc 163 164// --------------------------------------------------------------------- 165 166%define OT_LeastSquaresMethod_getGramInverseDiag_doc 167"Get the diagonal of the inverse Gram matrix. 168 169.. math:: 170 171 diag(G^{-1}) = diag((X^T * X)^{-1}) 172 173Returns 174------- 175d : :class:`~openturns.Point` 176 The diagonal of the inverse Gram matrix." 177%enddef 178%feature("docstring") OT::LeastSquaresMethodImplementation::getGramInverseDiag 179OT_LeastSquaresMethod_getGramInverseDiag_doc 180 181// --------------------------------------------------------------------- 182 183%define OT_LeastSquaresMethod_getGramInverseTrace_doc 184"Get the trace of the inverse Gram matrix. 185 186.. math:: 187 188 Tr(G^{-1}) = Tr(x^T * x)^{-1} 189 190Returns 191------- 192x : :class:`~openturns.Scalar` 193 The trace of inverse Gram matrix." 194%enddef 195%feature("docstring") OT::LeastSquaresMethodImplementation::getGramInverseTrace 196OT_LeastSquaresMethod_getGramInverseTrace_doc 197 198// --------------------------------------------------------------------- 199 200%define OT_LeastSquaresMethod_getH_doc 201"Get the projection matrix H. 202 203.. math:: 204 205 H = X * (X^T * X)^{-1} * X^T 206 207Returns 208------- 209h : :class:`~openturns.SymmetricMatrix` 210 The projection matrix H." 211%enddef 212%feature("docstring") OT::LeastSquaresMethodImplementation::getH 213OT_LeastSquaresMethod_getH_doc 214 215// --------------------------------------------------------------------- 216 217%define OT_LeastSquaresMethod_getHDiag_doc 218"Get the diagonal of the projection matrix H. 219 220.. math:: 221 222 H = X * (X^T * X)^{-1} * X^T 223 224Returns 225------- 226d : :class:`~openturns.Point` 227 The diagonal of H." 228%enddef 229%feature("docstring") OT::LeastSquaresMethodImplementation::getHDiag 230OT_LeastSquaresMethod_getHDiag_doc 231 232// --------------------------------------------------------------------- 233 234%define OT_LeastSquaresMethod_computeWeightedDesign_doc 235"Build the design matrix. 236 237Parameters 238---------- 239whole : bool, defaults to False 240 Whether to use the initial indices instead of the current indices 241 242Returns 243------- 244psiAk : :class:`~openturns.Matrix` 245 The design matrix" 246%enddef 247%feature("docstring") OT::LeastSquaresMethodImplementation::computeWeightedDesign 248OT_LeastSquaresMethod_computeWeightedDesign_doc 249 250// --------------------------------------------------------------------- 251 252%define OT_LeastSquaresMethod_trashDecomposition_doc 253"Drop the current decomposition." 254%enddef 255%feature("docstring") OT::LeastSquaresMethodImplementation::trashDecomposition 256OT_LeastSquaresMethod_trashDecomposition_doc 257 258// --------------------------------------------------------------------- 259 260%define OT_LeastSquaresMethod_update_doc 261"Update the current decomposition. 262 263Parameters 264---------- 265addedIndices : sequence of int 266 Indices of added basis terms. 267conservedIndices : sequence of int 268 Indices of conserved basis terms. 269removedIndices : sequence of int 270 Indices of removed basis terms." 271%enddef 272%feature("docstring") OT::LeastSquaresMethodImplementation::update 273OT_LeastSquaresMethod_update_doc 274 275 276