predict_laplace
- hybrid_learning.concepts.train_eval.train_eval_funs.predict_laplace(model, data, device=None, var0=None)[source]
Performs prediction with probit approximation of the Bayesian posterior. See [MacKay1992] for details.
Assumptions on the layers to process (currently:: layers are assumed to be named
"concept_layer_{i}")ALl layers are convolutional layers with attributes
kernelandbias.Hessian available for each layer as attribute
layer.hessianIf
var0is unset, variance is available for each layer as attributelayer.var0
Note
Implementation note:: Currently, the kernel is flattened out for the calculation, leading to a considerable consumption of memory. Make sure enough memory is available.
- MacKay1992
MacKay, David JC. “The evidence framework applied to classification networks.” Neural computation 4.5 (1992): 720-736. https://github.com/wiseodd/last_layer_laplace/blob/master/paper/laplace/llla_binary.py