h0rton.losses
¶
Submodules¶
Package Contents¶
Classes¶
BaseGaussianNLL |
Abstract base class to represent the Gaussian negative log likelihood (NLL). |
DiagonalGaussianNLL |
The negative log likelihood (NLL) for a single Gaussian with diagonal covariance matrix |
LowRankGaussianNLL |
The negative log likelihood (NLL) for a single Gaussian with a full but constrained as low-rank plus diagonal covariance matrix |
DoubleLowRankGaussianNLL |
The negative log likelihood (NLL) for a mixture of two Gaussians, each with a full but constrained as low-rank plus diagonal covariance |
FullRankGaussianNLL |
The negative log likelihood (NLL) for a single Gaussian with a full-rank covariance matrix |
DoubleGaussianNLL |
The negative log likelihood (NLL) for a mixture of two Gaussians, each with a full but constrained as low-rank plus diagonal covariance |
BaseGaussianNLLCPU |
Abstract base class to represent the Gaussian negative log likelihood (NLL). |
DiagonalGaussianNLLCPU |
The negative log likelihood (NLL) for a single Gaussian with diagonal covariance matrix |
FullRankGaussianNLLCPU |
The negative log likelihood (NLL) for a single Gaussian with a full-rank covariance matrix |
DoubleGaussianNLLCPU |
The negative log likelihood (NLL) for a mixture of two Gaussians, each with a full but constrained as low-rank plus diagonal covariance |
BaseGaussianNLLNative |
Abstract base class to represent the Gaussian negative log likelihood (NLLNative). |
DiagonalGaussianNLLNative |
The negative log likelihood (NLLNative) for a single Gaussian with diagonal covariance matrix |
LowRankGaussianNLLNative |
The negative log likelihood (NLLNative) for a single Gaussian with a full but constrained as low-rank plus diagonal covariance matrix |
DoubleLowRankGaussianNLLNative |
The negative log likelihood (NLLNative) for a mixture of two Gaussians, each with a full but constrained as low-rank plus diagonal covariance |
FullRankGaussianNLLNative |
The negative log likelihood (NLLNative) for a single Gaussian with a full-rank covariance matrix |
DoubleGaussianNLLNative |
The negative log likelihood (NLLNative) for a mixture of two Gaussians, each with a full but constrained as low-rank plus diagonal covariance |
-
class
h0rton.losses.
BaseGaussianNLL
(Y_dim, device)[source]¶ Bases:
abc.ABC
Abstract base class to represent the Gaussian negative log likelihood (NLL).
Gaussian NLLs or mixtures thereof with various forms of the covariance matrix inherit from this class.
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
__call__
(self, pred, target)¶ Evaluate the NLL. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
nll_diagonal
(self, target, mu, logvar)¶ Evaluate the NLL for single Gaussian with diagonal covariance matrix
- target : torch.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior
- logvar : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the log of the diagonal elements of the covariance matrix
- torch.Tensor of shape
- NLL values
-
nll_low_rank
(self, target, mu, logvar, F, reduce=True)¶ Evaluate the NLL for a single Gaussian with a full but low-rank plus diagonal covariance matrix
- target : torch.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior
- logvar : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the log of the diagonal elements of the covariance matrix
- F : torch.Tensor of shape [batch_size, rank*Y_dim]
- network prediction of the low rank portion of the covariance matrix
- reduce : bool
- whether to take the mean across the batch
- torch.Tensor of shape [batch_size,]
- NLL values
-
nll_mixture_low_rank
(self, target, mu, logvar, F, mu2, logvar2, F2, alpha)¶ Evaluate the NLL for a single Gaussian with a full but low-rank plus diagonal covariance matrix Parameters ———- target : torch.Tensor of shape [batch_size, Y_dim]
Y labels- mu : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior for the first Gaussian
- logvar : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the log of the diagonal elements of the covariance matrix for the first Gaussian
- F : torch.Tensor of shape [batch_size, rank*Y_dim]
- network prediction of the low rank portion of the covariance matrix for the first Gaussian
- mu2 : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior for the second Gaussian
- logvar2 : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the log of the diagonal elements of the covariance matrix for the second Gaussian
- F2 : torch.Tensor of shape [batch_size, rank*Y_dim]
- network prediction of the low rank portion of the covariance matrix for the second Gaussian
- alpha : torch.Tensor of shape [batch_size, 1]
- network prediction of the logit of twice the weight on the second Gaussian
- reduce : bool
- whether to take the mean across the batch
The weight on the second Gaussian is required to be less than 0.5, to make the two Gaussians well-defined. Returns ——- torch.Tensor of shape [batch_size,]
NLL values
-
nll_full_rank
(self, target, mu, tril_elements, reduce=True)¶ Evaluate the NLL for a single Gaussian with a full-rank covariance matrix
- target : torch.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior
tril_elements : torch.Tensor of shape [batch_size, Y_dim*(Y_dim + 1)//2] reduce : bool
whether to take the mean across the batch- torch.Tensor of shape [batch_size,]
- NLL values
-
nll_mixture
(self, target, mu, tril_elements, mu2, tril_elements2, alpha)¶ Evaluate the NLL for a single Gaussian with a full but low-rank plus diagonal covariance matrix
- target : torch.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior for the first Gaussian
- tril_elements : torch.Tensor of shape [batch_size, self.tril_len]
- network prediction of the elements in the precision matrix
- mu2 : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior for the second Gaussian
- tril_elements2 : torch.Tensor of shape [batch_size, self.tril_len]
- network prediction of the elements in the precision matrix for the second Gaussian
- alpha : torch.Tensor of shape [batch_size, 1]
- network prediction of the logit of twice the weight on the second Gaussian
The weight on the second Gaussian is required to be less than 0.5, to make the two Gaussians well-defined.
- torch.Tensor of shape [batch_size,]
- NLL values
-
-
class
h0rton.losses.
DiagonalGaussianNLL
(Y_dim, device)[source]¶ Bases:
h0rton.losses.gaussian_nll.BaseGaussianNLL
The negative log likelihood (NLL) for a single Gaussian with diagonal covariance matrix
BaseGaussianNLL.__init__ docstring for the parameter description.
-
posterior_name
= DiagonalGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLL. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
LowRankGaussianNLL
(Y_dim, device)[source]¶ Bases:
h0rton.losses.gaussian_nll.BaseGaussianNLL
The negative log likelihood (NLL) for a single Gaussian with a full but constrained as low-rank plus diagonal covariance matrix
Only rank 2 is currently supported. BaseGaussianNLL.__init__ docstring for the parameter description.
-
posterior_name
= LowRankGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLL. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
DoubleLowRankGaussianNLL
(Y_dim, device)[source]¶ Bases:
h0rton.losses.gaussian_nll.BaseGaussianNLL
The negative log likelihood (NLL) for a mixture of two Gaussians, each with a full but constrained as low-rank plus diagonal covariance
Only rank 2 is currently supported. BaseGaussianNLL.__init__ docstring for the parameter description.
-
posterior_name
= DoubleLowRankGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLL. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
FullRankGaussianNLL
(Y_dim, device)[source]¶ Bases:
h0rton.losses.gaussian_nll.BaseGaussianNLL
The negative log likelihood (NLL) for a single Gaussian with a full-rank covariance matrix
See BaseGaussianNLL.__init__ docstring for the parameter description.
-
posterior_name
= FullRankGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLL. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
DoubleGaussianNLL
(Y_dim, device)[source]¶ Bases:
h0rton.losses.gaussian_nll.BaseGaussianNLL
The negative log likelihood (NLL) for a mixture of two Gaussians, each with a full but constrained as low-rank plus diagonal covariance
Only rank 2 is currently supported. BaseGaussianNLL.__init__ docstring for the parameter description.
-
posterior_name
= DoubleGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLL. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
BaseGaussianNLLCPU
(Y_dim)[source]¶ Bases:
abc.ABC
Abstract base class to represent the Gaussian negative log likelihood (NLL).
Gaussian NLLs or mixtures thereof with various forms of the covariance matrix inherit from this class.
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : np.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
__call__
(self, pred, target)¶ Evaluate the NLL. Must be overridden by subclasses.
- pred : np.Tensor
- raw network output for the predictions
- target : np.Tensor
- Y labels
-
nll_diagonal
(self, target, mu, logvar)¶ Evaluate the NLL for single Gaussian with diagonal covariance matrix
- target : np.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : np.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior
- logvar : np.Tensor of shape [batch_size, Y_dim]
- network prediction of the log of the diagonal elements of the covariance matrix
- np.Tensor of shape
- NLL values
-
nll_full_rank
(self, target, mu, tril_elements, reduce=True)¶ Evaluate the NLL for a single Gaussian with a full-rank covariance matrix
- target : np.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : np.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior
tril_elements : np.Tensor of shape [batch_size, Y_dim*(Y_dim + 1)//2] reduce : bool
whether to take the mean across the batch- np.Tensor of shape [batch_size,]
- NLL values
-
nll_mixture
(self, target, mu, tril_elements, mu2, tril_elements2, alpha)¶ Evaluate the NLL for a single Gaussian with a full but low-rank plus diagonal covariance matrix
- target : np.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : np.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior for the first Gaussian
- tril_elements : np.Tensor of shape [batch_size, self.tril_len]
- network prediction of the elements in the precision matrix
- mu2 : np.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior for the second Gaussian
- tril_elements2 : np.Tensor of shape [batch_size, self.tril_len]
- network prediction of the elements in the precision matrix for the second Gaussian
- alpha : np.Tensor of shape [batch_size, 1]
- network prediction of the logit of twice the weight on the second Gaussian
The weight on the second Gaussian is required to be less than 0.5, to make the two Gaussians well-defined.
- np.Tensor of shape [batch_size,]
- NLL values
-
-
class
h0rton.losses.
DiagonalGaussianNLLCPU
(Y_dim)[source]¶ Bases:
h0rton.losses.gaussian_nll_cpu.BaseGaussianNLLCPU
The negative log likelihood (NLL) for a single Gaussian with diagonal covariance matrix
BaseGaussianNLLCPU.__init__ docstring for the parameter description.
-
posterior_name
= DiagonalGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLL. Must be overridden by subclasses.
- pred : np.Tensor
- raw network output for the predictions
- target : np.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : np.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
FullRankGaussianNLLCPU
(Y_dim)[source]¶ Bases:
h0rton.losses.gaussian_nll_cpu.BaseGaussianNLLCPU
The negative log likelihood (NLL) for a single Gaussian with a full-rank covariance matrix
See BaseGaussianNLLCPU.__init__ docstring for the parameter description.
-
posterior_name
= FullRankGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLL. Must be overridden by subclasses.
- pred : np.Tensor
- raw network output for the predictions
- target : np.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : np.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
DoubleGaussianNLLCPU
(Y_dim)[source]¶ Bases:
h0rton.losses.gaussian_nll_cpu.BaseGaussianNLLCPU
The negative log likelihood (NLL) for a mixture of two Gaussians, each with a full but constrained as low-rank plus diagonal covariance
Only rank 2 is currently supported. BaseGaussianNLLCPU.__init__ docstring for the parameter description.
-
posterior_name
= DoubleGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLL. Must be overridden by subclasses.
- pred : np.Tensor
- raw network output for the predictions
- target : np.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : np.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
BaseGaussianNLLNative
(Y_dim, device)[source]¶ Bases:
abc.ABC
Abstract base class to represent the Gaussian negative log likelihood (NLLNative).
Gaussian NLLNatives or mixtures thereof with various forms of the covariance matrix inherit from this class.
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
__call__
(self, pred, target)¶ Evaluate the NLLNative. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
nll_diagonal
(self, target, mu, logvar)¶ Evaluate the NLLNative for single Gaussian with diagonal covariance matrix
- target : torch.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior
- logvar : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the log of the diagonal elements of the covariance matrix
- torch.Tensor of shape
- NLL values
-
nll_low_rank
(self, target, mu, logvar, F, reduce=True)¶ Evaluate the NLLNative for a single Gaussian with a full but low-rank plus diagonal covariance matrix
- target : torch.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior
- logvar : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the log of the diagonal elements of the covariance matrix
- F : torch.Tensor of shape [batch_size, rank*Y_dim]
- network prediction of the low rank portion of the covariance matrix
- reduce : bool
- whether to take the mean across the batch
- torch.Tensor of shape [batch_size,]
- NLL values
-
nll_mixture_low_rank
(self, target, mu, logvar, F, mu2, logvar2, F2, alpha)¶ Evaluate the NLLNative for a single Gaussian with a full but low-rank plus diagonal covariance matrix Parameters ———- target : torch.Tensor of shape [batch_size, Y_dim]
Y labels- mu : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior for the first Gaussian
- logvar : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the log of the diagonal elements of the covariance matrix for the first Gaussian
- F : torch.Tensor of shape [batch_size, rank*Y_dim]
- network prediction of the low rank portion of the covariance matrix for the first Gaussian
- mu2 : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior for the second Gaussian
- logvar2 : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the log of the diagonal elements of the covariance matrix for the second Gaussian
- F2 : torch.Tensor of shape [batch_size, rank*Y_dim]
- network prediction of the low rank portion of the covariance matrix for the second Gaussian
- alpha : torch.Tensor of shape [batch_size, 1]
- network prediction of the logit of twice the weight on the second Gaussian
- reduce : bool
- whether to take the mean across the batch
The weight on the second Gaussian is required to be less than 0.5, to make the two Gaussians well-defined. Returns ——- torch.Tensor of shape [batch_size,]
NLL values
-
nll_full_rank
(self, target, mu, tril_elements, reduce=True)¶ Evaluate the NLLNative for a single Gaussian with a full-rank covariance matrix
- target : torch.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior
tril_elements : torch.Tensor of shape [batch_size, Y_dim*(Y_dim + 1)//2] reduce : bool
whether to take the mean across the batch- torch.Tensor of shape [batch_size,]
- NLL values
-
nll_mixture
(self, target, mu, tril_elements, mu2, tril_elements2, alpha)¶ Evaluate the NLLNative for a single Gaussian with a full but low-rank plus diagonal covariance matrix
- target : torch.Tensor of shape [batch_size, Y_dim]
- Y labels
- mu : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior for the first Gaussian
- tril_elements : torch.Tensor of shape [batch_size, self.tril_len]
- network prediction of the elements in the precision matrix
- mu2 : torch.Tensor of shape [batch_size, Y_dim]
- network prediction of the mu (mean parameter) of the BNN posterior for the second Gaussian
- tril_elements2 : torch.Tensor of shape [batch_size, self.tril_len]
- network prediction of the elements in the precision matrix for the second Gaussian
- alpha : torch.Tensor of shape [batch_size, 1]
- network prediction of the logit of twice the weight on the second Gaussian
The weight on the second Gaussian is required to be less than 0.5, to make the two Gaussians well-defined.
- torch.Tensor of shape [batch_size,]
- NLL values
-
-
class
h0rton.losses.
DiagonalGaussianNLLNative
(Y_dim, device)[source]¶ Bases:
h0rton.losses.gaussian_nll_native.BaseGaussianNLLNative
The negative log likelihood (NLLNative) for a single Gaussian with diagonal covariance matrix
BaseGaussianNLLNative.__init__ docstring for the parameter description.
-
posterior_name
= DiagonalGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLLNative. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
LowRankGaussianNLLNative
(Y_dim, device)[source]¶ Bases:
h0rton.losses.gaussian_nll_native.BaseGaussianNLLNative
The negative log likelihood (NLLNative) for a single Gaussian with a full but constrained as low-rank plus diagonal covariance matrix
Only rank 2 is currently supported. BaseGaussianNLLNative.__init__ docstring for the parameter description.
-
posterior_name
= LowRankGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLLNative. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
DoubleLowRankGaussianNLLNative
(Y_dim, device)[source]¶ Bases:
h0rton.losses.gaussian_nll_native.BaseGaussianNLLNative
The negative log likelihood (NLLNative) for a mixture of two Gaussians, each with a full but constrained as low-rank plus diagonal covariance
Only rank 2 is currently supported. BaseGaussianNLLNative.__init__ docstring for the parameter description.
-
posterior_name
= DoubleLowRankGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLLNative. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
FullRankGaussianNLLNative
(Y_dim, device)[source]¶ Bases:
h0rton.losses.gaussian_nll_native.BaseGaussianNLLNative
The negative log likelihood (NLLNative) for a single Gaussian with a full-rank covariance matrix
See BaseGaussianNLLNative.__init__ docstring for the parameter description.
-
posterior_name
= FullRankGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLLNative. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-
-
class
h0rton.losses.
DoubleGaussianNLLNative
(Y_dim, device)[source]¶ Bases:
h0rton.losses.gaussian_nll_native.BaseGaussianNLLNative
The negative log likelihood (NLLNative) for a mixture of two Gaussians, each with a full but constrained as low-rank plus diagonal covariance
Only rank 2 is currently supported. BaseGaussianNLLNative.__init__ docstring for the parameter description.
-
posterior_name
= DoubleGaussianBNNPosterior¶
-
__call__
(self, pred, target)¶ Evaluate the NLLNative. Must be overridden by subclasses.
- pred : torch.Tensor
- raw network output for the predictions
- target : torch.Tensor
- Y labels
-
slice
(self, pred)¶ Slice the raw network prediction into meaningful Gaussian parameters
- pred : torch.Tensor of shape [batch_size, self.Y_dim]
- the network prediction
-