SLogMI¶
sgptools.objectives.SLogMI
¶
Bases: MI
Computes the Mutual Information (MI) using tf.linalg.slogdet
for numerical stability,
especially for large or ill-conditioned covariance matrices.
The slogdet (sign and log determinant) method computes the sign and the natural
logarithm of the absolute value of the determinant of a square matrix.
This is more numerically stable than computing the determinant directly and then
taking the logarithm, as tf.linalg.det
can return very small or very large
numbers that lead to underflow/overflow when tf.math.log
is applied.
Jitter is also added to the diagonal for additional numerical stability.
Source code in sgptools/objectives.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
__call__(X)
¶
Computes the Mutual Information for the given input points X
using tf.linalg.slogdet
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
Tensor
|
The input points (e.g., sensing locations) for which MI is to be computed. Shape: (M, D). |
required |
Returns:
Type | Description |
---|---|
Tensor
|
tf.Tensor: The computed Mutual Information value. |
Usage
import gpflow
import numpy as np
# Assume X_objective and kernel are defined
# X_objective = np.random.rand(100, 2)
# kernel = gpflow.kernels.SquaredExponential()
# noise_variance = 0.1
slogmi_objective = SLogMI(X_objective=X_objective, kernel=kernel, noise_variance=noise_variance)
X_sensing = tf.constant(np.random.rand(10, 2), dtype=tf.float64)
mi_value = slogmi_objective(X_sensing)
Source code in sgptools/objectives.py
__init__(X_objective, kernel, noise_variance, jitter=1e-06, cache=True, **kwargs)
¶
Initializes the Mutual Information (MI) objective based on tf.linalg.slogdet
.
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
|
cache
|
bool
|
If |
True
|
**kwargs
|
Any
|
Arbitrary keyword arguments. |
{}
|