Ops: keras_proba.ops¶
Tensor operations on the outputs and parameters of keras_proba layers.
mean_field_logits ¶
Adjusts the model logits so their softmax approximates the posterior mean [1].
[1]: Zhiyun Lu, Eugene Ie, Fei Sha. Uncertainty Estimation with Infinitesimal Jackknife. arXiv preprint arXiv:2006.07584, 2020. https://arxiv.org/abs/2006.07584
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logits
|
Float tensor of shape |
required | |
covariance_matrix
|
Covariance matrix of shape |
None
|
|
mean_field_factor
|
Scale factor of the mean-field approximation, which
controls the influence of the posterior variance. If
|
1.0
|
Returns:
| Type | Description |
|---|---|
|
Adjusted logits of shape |
split_gaussian_params ¶
Splits a GaussianHead output into (mean, scale).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Tensor of shape |
required |
Returns:
| Type | Description |
|---|---|
|
Tuple of |
split_mixture_params ¶
Splits a MixtureGaussianHead output into (logits, means, scales).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Tensor of shape |
required | |
units
|
Number of regression targets |
1
|
Returns:
| Type | Description |
|---|---|
|
Tuple of |
|
|
|
mixture_mean_and_stddev ¶
Predictive mean and standard deviation of a MixtureGaussianHead output.
The variance is the law of total variance, sum_k pi_k (scale_k^2 +
mean_k^2) - mean^2, so it includes the spread between components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Tensor of shape |
required | |
units
|
Number of regression targets. |
1
|
Returns:
| Type | Description |
|---|---|
|
Tuple of |
normal_kl_divergence ¶
KL(N(loc, scale^2) || N(0, prior_scale^2)), summed over all elements.