elicito.simulations#
Simulations from prior and model
Classes:
| Name | Description |
|---|---|
Priors |
Initialize the hyperparameters (i.e., trainable variables) |
Functions:
| Name | Description |
|---|---|
intialize_priors |
Initialize prior distributions. |
sample_from_priors |
Sample from initialized prior distributions. |
simulate_from_generator |
Simulate data from the specified generative model. |
Priors #
Bases: Module
Initialize the hyperparameters (i.e., trainable variables)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ground_truth
|
bool
|
True if expert data are simulated from a given ground truth (oracle) |
required |
init_matrix_slice
|
Optional[dict[str, Tensor]]
|
Samples drawn from the initialization distribution to initialize
the hyperparameter of the parametric prior distributions
Only required for |
required |
trainer
|
Trainer
|
Specification of training settings |
required |
parameters
|
list[Parameter]
|
List of model parameters |
required |
network
|
Optional[NFDict]
|
Specification of neural network
Only required for |
required |
expert
|
ExpertDict
|
Provide input data from expert or simulate data from oracle with
either the |
required |
seed
|
int
|
Seed used for learning. |
required |
Methods:
| Name | Description |
|---|---|
__call__ |
Sample from the initialized prior distribution(s). |
Source code in src/elicito/simulations.py
__call__ #
__call__() -> Any
Sample from the initialized prior distribution(s).
Returns:
| Type | Description |
|---|---|
prior_samples
|
Samples from prior distribution(s). |
Source code in src/elicito/simulations.py
intialize_priors #
intialize_priors(
init_matrix_slice: Optional[dict[str, Tensor]],
method: str,
seed: int,
parameters: list[Parameter],
network: Optional[NFDict],
) -> dict[str, Tensor]
Initialize prior distributions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_matrix_slice
|
Optional[dict[str, Tensor]]
|
Samples drawn from the initialization distribution to initialize the hyperparameter of the parametric prior distributions Only for method="parametric_prior", otherwise None. |
required |
method
|
str
|
Parametric_prior or deep_prior method |
required |
seed
|
int
|
Seed of current workflow run |
required |
parameters
|
list[Parameter]
|
List of model parameter |
required |
network
|
Optional[NFDict]
|
specification of neural network
Only required for |
required |
Returns:
| Name | Type | Description |
|---|---|---|
init_prior |
dict[str, Tensor]
|
returns initialized prior distributions ready for prior sampling. |
Source code in src/elicito/simulations.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
sample_from_priors #
sample_from_priors(
initialized_priors: Union[
None, dict[str, Tensor], Callable[[Any], Any]
],
ground_truth: bool,
num_samples: int,
B: int,
seed: int,
method: str,
parameters: list[Parameter],
network: Optional[NFDict],
expert: ExpertDict,
) -> Any
Sample from initialized prior distributions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initialized_priors
|
Union[None, dict[str, Tensor], Callable[[Any], Any]]
|
Initialized prior distributions ready for prior sampling. |
required |
ground_truth
|
bool
|
True if expert data is simulated from ground truth. |
required |
num_samples
|
int
|
Number of samples from the prior(s). |
required |
B
|
int
|
Batch size. |
required |
seed
|
int
|
Seed used for learning. |
required |
method
|
str
|
Parametric_prior or deep_prior method |
required |
parameters
|
list[Parameter]
|
List of model parameters |
required |
network
|
Optional[NFDict]
|
Specification of neural network
Only required for |
required |
expert
|
ExpertDict
|
Provide input data from expert or simulate data from oracle with
either the |
required |
Returns:
| Name | Type | Description |
|---|---|---|
prior_samples |
Any
|
Samples from prior distributions. |
Source code in src/elicito/simulations.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
simulate_from_generator #
Simulate data from the specified generative model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prior_samples
|
Tensor
|
Samples from prior distributions. |
required |
seed
|
int
|
Seed used for learning. Specification in :func: |
required |
model
|
dict[str, Any]
|
Specification of generative model using :func: |
required |
Returns:
| Name | Type | Description |
|---|---|---|
model_simulations |
Any
|
simulated data from generative model. |