gemseo_mlearning / regression

Show inherited members

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: MLRegressionAlgo

Gaussian 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 Transformer while 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, the Transformer will be applied to all the variables of this group. If IDENTITY, 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 than MAX_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: StrEnum

The 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_hmat is True.

HMATRIX_RECOMPRESSION_EPSILON: ClassVar[float] = 0.0001

The epsilon used for the recompression of the H-matrix.

Used when use_hmat is True.

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}" or f"{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.

input_names: list[str]

The names of the input variables.

input_space_center: dict[str, ndarray]

The center of the input space.

learning_set: Dataset

The learning dataset.

output_names: list[str]

The names of the output variables.

parameters: dict[str, MLAlgoParameterType]

The parameters of the machine learning algorithm.

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) where resampler is a Resampler, ml_algos is the list of the associated machine learning algorithms built during the resampling stage and predictions are the predictions obtained with the latter.

resampling_results stores 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 Transformer while 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, the Transformer will be applied to all the variables of this group.

property use_hmat: bool

Whether to use the HMAT linear algebra method or LAPACK.