qpots.model_object

class qpots.model_object.ModelObject(train_x: Tensor, train_y: Tensor, bounds: Tensor, nobj: int, ncons: int, ntrain: int | None = None, device: str | device | None = None, noise_std: float = 1e-06, dtype: dtype | None = None)[source]

Bases: object

A class representing multi-objective Gaussian Process (GP) models.

This class constructs and fits independent Gaussian Process models for each objective using Maximum Likelihood Estimation (MLE). The models are used in multi-objective optimization problems where constraints can be included.

__init__(train_x: Tensor, train_y: Tensor, bounds: Tensor, nobj: int, ncons: int, ntrain: int | None = None, device: str | device | None = None, noise_std: float = 1e-06, dtype: dtype | None = None)[source]

Initialize the multi-objective GP models.

Parameters:
  • train_x (torch.Tensor) – The input training data of shape (n, d), where n is the number of samples and d is the input dimension.

  • train_y (torch.Tensor) – The output training data of shape (n, k), where k is the number of objectives.

  • bounds (torch.Tensor) – A tensor specifying the lower and upper bounds for the input space.

  • nobj (int) – The number of objective functions.

  • ncons (int) – The number of constraints in the problem.

  • ntrain (int, optional) – Number of initial fully observed training points. If omitted, all rows in train_x are treated as initial training points.

  • device (torch.device or str, optional) – Computation device. If omitted, qPOTS uses CUDA when available and falls back to CPU.

  • noise_std (float, optional) – The standard deviation of noise added to the GP model. Defaults to 1e-6.

  • dtype (torch.dtype, optional) – Floating-point precision. If omitted, qPOTS uses qpots.config.DEFAULT_DTYPE.

fit_gp(single_objective=False)[source]

Fit Gaussian Process (GP) models using Maximum Likelihood Estimation (MLE).

This method fits nobj independent GP models, each corresponding to an objective function. The models are trained using exact marginal log likelihood.

Parameters:

single_objective (bool) – If True, fit just one GP otherwise fit GP for each objective

Return type:

None

fit_gp_no_variance(single_objective=False)[source]

Fit Gaussian Process (GP) models without variance estimation.

This method is similar to fit_gp(), but does not include variance in the GP model. It fits nobj independent GP models using Maximum Likelihood Estimation (MLE).

Parameters:

single_objective (bool) – If True, fit just one GP otherwise fit GP for each objective

Return type:

None

fit_multitask_gp()[source]

Fit a MultiTask Gaussian Process (GP) model for objectives and constraints.

This method constructs and fits a single MultiTaskGP model that jointly models all objectives and constraints. Missing (NaN) target values are ignored during training, and each input is augmented with a task index.

Parameters:

None

Return type:

None

standardize_ignore_nan(Y: Tensor) Tensor[source]

Standardize Y along dim=0 ignoring NaNs. NaNs remain in place. :param Y: Input tensor to be standardized. :type Y: torch.Tensor

Returns:

Standardized tensor with NaN values preserved.

Return type:

torch.Tensor