Base Parameter Distributions
ParamDist
Bases: Distribution, ABC
Source code in src/methods/bayes/base/distribution.py
map: torch.Tensor
abstractmethod
property
Returns mode of the distibution. It has a sense of maximum aposteriori estimation for bayessian nets.
Returns:
| Type | Description |
|---|---|
Tensor
|
torch.Tensor: MAP parameters |
mean: torch.Tensor
abstractmethod
property
Returns mean of the distibution. It has a sense of non-bias estimation for bayessian nets.
Returns:
| Type | Description |
|---|---|
Tensor
|
torch.Tensor: mean parameters |
from_parameter(p)
abstractmethod
classmethod
Default initialization of ParamDist forom parameters of nn.Module
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
Parameter
|
paramaters for which ParamDist should be created. |
required |
Source code in src/methods/bayes/base/distribution.py
get_params()
abstractmethod
Returns dictionary of parameters that should be registered as parameters at nn.Module.
log_prob(weights)
abstractmethod
Returns logarithm of probability density function of distibution evaluated at weights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weights
|
Tensor
|
the point at which probability should be evaluated. |
required |
Source code in src/methods/bayes/base/distribution.py
log_z_test()
abstractmethod
Returns parameter which is used to be compared with threshold to estimate wether this parameter should be pruned. By default it is logarithm of z_test or equivalent of it. log_z_test = log(abs(mean)) - log(variance)
Source code in src/methods/bayes/base/distribution.py
rsample(sample_shape=torch.Size())
abstractmethod
Returns parameters sampled using reparametrization trick, so they could be used for gradient estimation
Returns:
| Type | Description |
|---|---|
Tensor
|
torch.Tensor: sampled parameters |
Source code in src/methods/bayes/base/distribution.py
variance()
abstractmethod
Returns variance of the distibution. It has a sense of error estimation for bayessian nets and assumed to be used in prunning.