SchurMI¶
sgptools.objectives.SchurMI
¶
Bases: SLogMI
Computes Mutual Information (MI) using the Schur complement for improved numerical stability and computational efficiency.
This method leverages the properties of block matrix determinants to reformulate the MI calculation. The standard MI formula is: \(MI = \log|K_{XX}| + \log|K_{oo}| - \log|K_{combined}|\) where \(K_{XX} = K(X, X)\), \(K_{oo} = K(X_{objective}, X_{objective})\), and \(K_{combined}\) is the kernel of the union of the points.
Using the Schur complement identity for determinants, \(\log|K_{combined}| = \log|K_{oo}| + \log|K_{XX} - K_{Xo} K_{oo}^{-1} K_{oX}|\), the MI calculation simplifies to: \(MI = \log|K_{XX}| - \log|SchurComplement|\) where the Schur Complement is \(K_{XX} - K_{Xo} K_{oo}^{-1} K_{oX}\).
This approach is particularly efficient when the objective is evaluated
multiple times for different sensing locations \(X\) but with a fixed set of
\(X_{objective}\) points. By caching the inverse of \(K_{oo}\), we avoid costly
recomputations. Like SLogMI
, this class uses tf.linalg.slogdet
and
adds jitter for robust computation.
Source code in sgptools/objectives.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
|
__call__(X)
¶
Computes the Mutual Information for the input points X
using the
Schur complement method.
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
schur_mi_objective = SchurMI(
X_objective=X_objective,
kernel=kernel,
noise_variance=noise_variance
)
X_sensing = tf.constant(np.random.rand(10, 2), dtype=tf.float64)
mi_value = schur_mi_objective(X_sensing)
Source code in sgptools/objectives.py
__init__(X_objective, kernel, noise_variance, jitter=1e-06, cache=True, **kwargs)
¶
Initializes the SchurMI objective.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X_objective
|
ndarray
|
The fixed set of data points against which MI is computed. Shape: (N, D). |
required |
kernel
|
Kernel
|
The GPflow kernel to compute covariances. |
required |
noise_variance
|
float
|
The observed data noise variance. |
required |
jitter
|
float
|
A small value added to the diagonal of covariance matrices for numerical stability. Defaults to 1e-6. |
1e-06
|
cache
|
bool
|
If |
True
|
**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 |