Metrics
sgptools.utils.metrics
gaussian_entropy(K)
Computes GP-based entropy from a kernel matrix
Parameters:
Name | Type | Description | Default |
---|---|---|---|
K |
ndarray
|
(n, n); kernel matrix |
required |
Returns:
Name | Type | Description |
---|---|---|
entropy |
float
|
Entropy computed from the kernel matrix |
Source code in sgptools/utils/metrics.py
get_distance(X)
Compute the length of a path (L2-norm)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
ndarray
|
(m, d); Waypoints of a path |
required |
Returns:
Name | Type | Description |
---|---|---|
dist |
float
|
Total path length |
Source code in sgptools/utils/metrics.py
get_elbo(Xu, X_env, noise_variance, kernel, baseline=False)
Computes the ELBO of the SGP, corrected to be positive
Parameters:
Name | Type | Description | Default |
---|---|---|---|
Xu |
ndarray
|
(m, d); Sensing locations |
required |
X_env |
ndarray
|
(n, d); Data points used to approximate the bounds of the environment |
required |
noise_variance |
float
|
data variance |
required |
kernel |
Kernel
|
gpflow kernel function |
required |
baseline |
bool
|
If True, the ELBO is adjusted to be positive |
False
|
Returns:
Name | Type | Description |
---|---|---|
elbo |
float
|
ELBO of the SGP |
Source code in sgptools/utils/metrics.py
get_kl(Xu, X_env, noise_variance, kernel)
Computes the KL divergence between the SGP and the GP
Parameters:
Name | Type | Description | Default |
---|---|---|---|
Xu |
ndarray
|
(m, d); Sensing locations |
required |
X_env |
ndarray
|
(n, d); Data points used to approximate the bounds of the environment |
required |
noise_variance |
float
|
data variance |
required |
kernel |
Kernel
|
gpflow kernel function |
required |
Returns:
Name | Type | Description |
---|---|---|
kl |
float
|
KL divergence between the SGP and the GP |
Source code in sgptools/utils/metrics.py
get_mi(Xu, candidate_locs, noise_variance, kernel)
Computes mutual information between the sensing locations and the candidate locations
Parameters:
Name | Type | Description | Default |
---|---|---|---|
Xu |
ndarray
|
(m, d); Sensing locations |
required |
candidate_locs |
ndarray
|
(n, d); Candidate sensing locations |
required |
noise_variance |
float
|
data variance |
required |
kernel |
Kernel
|
gpflow kernel function |
required |
Returns:
Name | Type | Description |
---|---|---|
mi |
float
|
Mutual information computed using a GP |
Source code in sgptools/utils/metrics.py
get_reconstruction(sensor_data, X_test, noise_variance, kernel)
Computes the GP-based data field estimates with the solution placements as the training set
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sensor_data |
ndarray tuple
|
((m, d), (m, 1)); Sensing locations' input and corresponding ground truth labels |
required |
X_test |
ndarray
|
(n, d); Testing data input locations |
required |
noise_variance |
float
|
data variance |
required |
kernel |
Kernel
|
gpflow kernel function |
required |
Returns:
Name | Type | Description |
---|---|---|
y_pred |
ndarray
|
(n, 1); Predicted data field estimates |
y_var |
ndarray
|
(n, 1); Prediction variance at each location in the data field |
Source code in sgptools/utils/metrics.py
get_rmse(y_pred, y_test)
Computes the root-mean-square error between y_pred
and y_test
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_pred |
ndarray
|
(n, 1); Predicted data field estimate |
required |
y_test |
ndarray
|
(n, 1); Ground truth data field |
required |
Returns:
Name | Type | Description |
---|---|---|
rmse |
float
|
Computed RMSE |