ot_gpr module¶
Gaussian process regression model from OpenTURNS.
- class gemseo_mlearning.regression.ot_gpr.OTGaussianProcessRegressor(data, transformer=None, input_names=None, output_names=None, use_hmat=None, trend_type=TrendType.CONSTANT, optimizer=class=TNC class=OptimizationAlgorithmImplementation problem=class=OptimizationProblem implementation=class=OptimizationProblemImplementation objective=class=Function name=Unnamed implementation=class=FunctionImplementation name=Unnamed description=[] evaluationImplementation=class=NoEvaluation name=Unnamed gradientImplementation=class=NoGradient name=Unnamed hessianImplementation=class=NoHessian name=Unnamed equality constraint=none inequality constraint=none bounds=none minimization=true dimension=0 startingPoint=class=Point name=Unnamed dimension=0 values=[] maximumIterationNumber=100 maximumEvaluationNumber=1000 maximumAbsoluteError=1e-05 maximumRelativeError=1e-05 maximumResidualError=1e-05 maximumConstraintError=1e-05 verbose=false scale=class=Point name=Unnamed dimension=0 values=[] offset=class=Point name=Unnamed dimension=0 values=[] maxCGit=50 eta=0.25 stepmx=10 accuracy=0.0001 fmin=1 rescale=1.3)[source]
Bases:
MLRegressionAlgoGaussian process regression model from OpenTURNS.
- Parameters:
data (Dataset) – The learning dataset.
transformer (TransformerType | None) – The strategies to transform the variables. The values are instances of
Transformerwhile the keys are the names of either the variables or the groups of variables, e.g."inputs"or"outputs"in the case of the regression algorithms. If a group is specified, theTransformerwill be applied to all the variables of this group. IfIDENTITY, do not transform the variables.input_names (Iterable[str] | None) – The names of the input variables. If
None, consider all the input variables of the learning dataset.output_names (Iterable[str] | None) – The names of the output variables. If
None, consider all the output variables of the learning dataset.use_hmat (bool | None) – Whether to use the HMAT or LAPACK as linear algebra method. If
None, use HMAT when the learning size is greater thanMAX_SIZE_FOR_LAPACK.trend_type (TrendType) –
The type of the trend.
By default it is set to “constant”.
optimizer (OptimizationAlgorithmImplementation) –
The solver used to optimize the covariance model parameters.
By default it is set to class=TNC class=OptimizationAlgorithmImplementation problem=class=OptimizationProblem implementation=class=OptimizationProblemImplementation objective=class=Function name=Unnamed implementation=class=FunctionImplementation name=Unnamed description=[] evaluationImplementation=class=NoEvaluation name=Unnamed gradientImplementation=class=NoGradient name=Unnamed hessianImplementation=class=NoHessian name=Unnamed equality constraint=none inequality constraint=none bounds=none minimization=true dimension=0 startingPoint=class=Point name=Unnamed dimension=0 values=[] maximumIterationNumber=100 maximumEvaluationNumber=1000 maximumAbsoluteError=1e-05 maximumRelativeError=1e-05 maximumResidualError=1e-05 maximumConstraintError=1e-05 verbose=false scale=class=Point name=Unnamed dimension=0 values=[] offset=class=Point name=Unnamed dimension=0 values=[] maxCGit=50 eta=0.25 stepmx=10 accuracy=0.0001 fmin=1 rescale=1.3.
- Raises:
ValueError – When both the variable and the group it belongs to have a transformer.
- class TrendType(value)[source]
Bases:
StrEnumThe trend type of the Gaussian process regressor.
- CONSTANT = 'constant'
- LINEAR = 'linear'
- QUADRATIC = 'quadratic'
- predict_std(input_data)[source]
Predict the standard deviation from input data.
- Parameters:
input_data (DataType) – The input data with shape (n_samples, n_inputs).
- Returns:
The output data with shape (n_samples, n_outputs).
- Return type:
output_data
- HMATRIX_ASSEMBLY_EPSILON: ClassVar[float] = 1e-05
The epsilon used for the assembly of the H-matrix.
Used when
use_hmatisTrue.
- HMATRIX_RECOMPRESSION_EPSILON: ClassVar[float] = 0.0001
The epsilon used for the recompression of the H-matrix.
Used when
use_hmatisTrue.
- LIBRARY: Final[str] = 'OpenTURNS'
The name of the library of the wrapped machine learning algorithm.
- MAX_SIZE_FOR_LAPACK: ClassVar[int] = 100
The maximum size of the learning dataset to use LAPACK as linear algebra library.
Use HMAT otherwise.
- SHORT_ALGO_NAME: ClassVar[str] = 'GPR'
The short name of the machine learning algorithm, often an acronym.
Typically used for composite names, e.g.
f"{algo.SHORT_ALGO_NAME}_{dataset.name}"orf"{algo.SHORT_ALGO_NAME}_{discipline.name}".
- TNC: Final[TNC] = class=TNC class=OptimizationAlgorithmImplementation problem=class=OptimizationProblem implementation=class=OptimizationProblemImplementation objective=class=Function name=Unnamed implementation=class=FunctionImplementation name=Unnamed description=[] evaluationImplementation=class=NoEvaluation name=Unnamed gradientImplementation=class=NoGradient name=Unnamed hessianImplementation=class=NoHessian name=Unnamed equality constraint=none inequality constraint=none bounds=none minimization=true dimension=0 startingPoint=class=Point name=Unnamed dimension=0 values=[] maximumIterationNumber=100 maximumEvaluationNumber=1000 maximumAbsoluteError=1e-05 maximumRelativeError=1e-05 maximumResidualError=1e-05 maximumConstraintError=1e-05 verbose=false scale=class=Point name=Unnamed dimension=0 values=[] offset=class=Point name=Unnamed dimension=0 values=[] maxCGit=50 eta=0.25 stepmx=10 accuracy=0.0001 fmin=1 rescale=1.3
The TNC algorithm.
- algo: Any
The interfaced machine learning algorithm.
- learning_set: Dataset
The learning dataset.
- resampling_results: dict[str, tuple[Resampler, list[MLAlgo], list[ndarray] | ndarray]]
The resampler class names bound to the resampling results.
A resampling result is formatted as
(resampler, ml_algos, predictions)whereresampleris aResampler,ml_algosis the list of the associated machine learning algorithms built during the resampling stage andpredictionsare the predictions obtained with the latter.resampling_resultsstores only one resampling result per resampler type (e.g.,"CrossValidation","LeaveOneOut"and"Boostrap").
- transformer: dict[str, Transformer]
The strategies to transform the variables, if any.
The values are instances of
Transformerwhile the keys are the names of either the variables or the groups of variables, e.g. “inputs” or “outputs” in the case of the regression algorithms. If a group is specified, theTransformerwill be applied to all the variables of this group.
- property use_hmat: bool
Whether to use the HMAT linear algebra method or LAPACK.