Variance Bayessian NN
BaseBayesVarLayer
Bases: BayesLayer
Base Envelope for nn.Modules with some prior and posterior distributions as the variational distibution on paramters. This module should be used as parent class for all variational methods.
Source code in src/methods/bayes/variational/net.py
__init__(module)
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
Module
|
custom Module layer which is going to be converted to BaseBayesVarLayer |
required |
flush_weights()
This method simply zeros all weights that will be calculated by this layer and set them as tensors, so it will work properly when layer is initialized.
Source code in src/methods/bayes/variational/net.py
LogUniformVarLayer
Bases: BaseBayesVarLayer
Envelope for nn.Modules with the same LogUniform prior on all scalar paramters and factorized normal distributions as the variational distibution on paramters. The prior is not required here as its optimal form can be computed analytically.
Source code in src/methods/bayes/variational/net.py
__init__(module)
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
Module
|
custom Module layer which is going to be converted to LogUniformVarLayer |
required |
Source code in src/methods/bayes/variational/net.py
NormalVarBayesLayer
Bases: BaseBayesVarLayer
Envelope for nn.Modules with the same normal prior on all scalar paramters and factorized normal distributions as the variational distibution on paramters. The prior is not required here as its optimal form can be computed analytically.
Source code in src/methods/bayes/variational/net.py
__init__(module)
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
Module
|
custom Module layer which is going to be converted to NormalVarBayesLayer |
required |
Source code in src/methods/bayes/variational/net.py
VarBayesNet
Bases: BaseBayesNet
The whole net that contains all layers that should be tranfomed to bayesian modules. This net is used for variational bayesian methods.
Source code in src/methods/bayes/variational/net.py
__init__(base_module, module_dict)
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_module
|
Module
|
custom Module which is going to have some BayesModule as submodules |
required |
module_dict
|
dict[str, Module]
|
all submodules of the base_module supposed to be trained. This may be nn.Module or BayesModule. Such division is required because base_module is not registred as Module in this class. |
required |