DOptimal¶
sgptools.objectives.DOptimal
¶
Bases: Objective
Computes the D-optimal design metric.
D-optimality seeks to minimize the determinant of the posterior
covariance matrix \(|K(X, X)|\). The objective returns
the negative log-determinant of \(K(X, X)\), which is maximized during
optimization. tf.linalg.slogdet is used for numerical stability.
Source code in sgptools/objectives.py
__call__(X)
¶
Computes the negative log-determinant of the covariance matrix \(-log|K(X, X)|\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
Tensor
|
The input points (e.g., sensing locations) for which the objective is to be computed. Shape: (M, D). |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
tf.Tensor: The computed D-optimal metric value. |
Usage
import gpflow
import numpy as np
# Assume kernel is defined
# X_objective = np.random.rand(100, 2) # Not used by D-Optimal but required by base class
# kernel = gpflow.kernels.SquaredExponential()
# noise_variance = 0.1
d_optimal_objective = DOptimal(
X_objective=X_objective,
kernel=kernel,
noise_variance=noise_variance
)
X_sensing = tf.constant(np.random.rand(10, 2))
d_optimal_value = d_optimal_objective(X_sensing)
Source code in sgptools/objectives.py
__init__(X_objective, kernel, noise_variance, jitter=1e-06, **kwargs)
¶
Initializes the base objective. This constructor primarily serves to define the expected parameters for all objective subclasses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X_objective
|
ndarray
|
The fixed set of data points (e.g., candidate locations or training data points) against which MI is computed. Shape: (N, D). |
required |
kernel
|
Kernel
|
The GPflow kernel function to compute covariances. |
required |
noise_variance
|
float
|
The observed data noise variance, which is added to the jitter. |
required |
jitter
|
float
|
A small positive value to add for numerical stability to covariance matrix diagonals. Defaults to 1e-6. |
1e-06
|
**kwargs
|
Any
|
Arbitrary keyword arguments. |
{}
|
Source code in sgptools/objectives.py
update(kernel, noise_variance)
¶
Updates the kernel and noise variance for the MI objective. This method is crucial for optimizing the GP hyperparameters externally and having the objective function reflect those changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kernel
|
Kernel
|
The updated GPflow kernel function. |
required |
noise_variance
|
float
|
The updated data noise variance. |
required |