Grid utils
bayesian_model_average(viprs_grid_model, normalization='softmax')
¶
Use Bayesian model averaging (BMA) to obtain a weighing scheme for the variational parameters of a grid of VIPRS models. The parameters of each model in the grid are assigned weights proportional to their final ELBO.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
viprs_grid_model
|
An instance of |
required | |
normalization
|
The normalization scheme for the final ELBOs. Options are ( |
'softmax'
|
Raises:
| Type | Description |
|---|---|
KeyError
|
If the normalization scheme is not recognized. |
Source code in viprs/model/gridsearch/grid_utils.py
select_best_model(viprs_grid_model, validation_gdl=None, criterion='ELBO')
¶
From the grid of models that were fit to the data, select the best
model according to the specified criterion. If the criterion is the ELBO,
the model with the highest ELBO will be selected. If the criterion is
validation or pseudo-validation, the model with the highest R^2 on the
held-out validation set will be selected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
viprs_grid_model
|
An instance of |
required | |
validation_gdl
|
An instance of |
None
|
|
criterion
|
The criterion for selecting the best model. Options are: ( |
'ELBO'
|
Source code in viprs/model/gridsearch/grid_utils.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |