smc_standard
smc_standard(model, n_particles, ess_threshold=0.5, visualization_dir=None, json_file=None, resampling_method='stratified')
async
Standard sequential Monte Carlo algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Model
|
The model to perform inference on. |
required |
n_particles
|
int
|
Number of particles to execute concurrently. |
required |
ess_threshold
|
float
|
Effective sample size below which resampling is triggered, given as a fraction of |
0.5
|
visualization_dir
|
str
|
Path to the directory where the visualization server is running. |
None
|
json_file
|
str
|
Path to the JSON file to save the record of the inference, relative to |
None
|
resampling_method
|
str
|
One of 'multinomial', 'stratified', 'systematic', or 'residual'. Defaults to 'stratified' (lower variance than 'multinomial'). |
'stratified'
|
Returns:
| Name | Type | Description |
|---|---|---|
particles |
list[Model]
|
The completed particles after inference. |
Source code in llamppl/inference/smc_standard.py
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 | |