yamle.methods.rbnn module#
- yamle.methods.rbnn.replace_with_rbnn(model, num_members, prior_mean, log_variance, prior_log_variance, method)[source]#
- This method is used to replace all the nn.Linear, nn.Conv2d layers
with a LinearRBNN and Conv2dRBNN respectively.
- Parameters:
model¶ (nn.Module) – The model to replace the layers in.
num_members¶ (int) – The number of members in the ensemble.
prior_mean¶ (float) – The mean of the prior distribution.
log_variance¶ (float) – The initial value of the log of the standard deviation of the weights.
prior_log_variance¶ (float) – The initial value of the log of the standard deviation of the prior distribution.
method¶ (str) – The method whether additive or multiplicative to be used for the rank-1 approximation.
- Return type:
Module
- class yamle.methods.rbnn.RBNNMethod(prior_mean=1.0, log_variance=-3.0, prior_log_variance=-3.0, method='additive', **kwargs)[source]#
Bases:
SVIMethodThis class is the extension of the base method for Rank-1 Bayesian Neural Networks.
- Parameters:
num_members¶ (int) – The number of members in the ensemble.
prior_mean¶ (float) – The mean of the prior distribution.
log_variance¶ (float) – The initial value of the log of the standard deviation of the weights.
prior_log_variance¶ (float) – The initial value of the log of the standard deviation of the prior distribution.
method¶ (str) – The method whether additive or multiplicative to be used for the rank-1 approximation.
- static add_specific_args(parent_parser)[source]#
This method adds the specific arguments for the MIMO method.
- Return type:
ArgumentParser
- test_name: Optional[str]#
- prepare_data_per_node: bool#
- allow_zero_length_dataloader_with_multiple_devices: bool#
- training: bool#