-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
115 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Chain | ||
========= | ||
|
||
.. function:: Chain(weight::Float64, value::Array{Sample}) | ||
|
||
A wrapper of output trajactory of samplers. | ||
|
||
Example: | ||
|
||
.. code-block:: julia | ||
# Define a model | ||
@model xxx begin | ||
... | ||
@predict mu sigma | ||
end | ||
# Run the inference engine | ||
chain = sample(xxx, SMC(1000)) | ||
chain[:logevidence] # show the log model evidence | ||
chain[:mu] # show the weighted trajactory for :mu | ||
chain[:sigma] # show the weighted trajactory for :sigma | ||
mean(chain[:mu]) # find the mean of :mu | ||
mean(chain[:sigma]) # find the mean of :sigma | ||
.. function:: Sample(weight::Float64, value::Dict{Symbol,Any}) | ||
|
||
A wrapper of output samples. | ||
|
||
Example: | ||
|
||
.. code-block:: julia | ||
# Define a model | ||
@model xxx begin | ||
... | ||
@predict mu sigma | ||
end | ||
# Run the inference engine | ||
chain = sample(xxx, SMC(1000)) | ||
sample = chain[:mu][1] # get the first sample | ||
sample.weight # show the weight of this sample | ||
sample.value # show the value of this sample (a dictionary) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,9 @@ Contents | |
|
||
replayapi | ||
samplerapi | ||
tarray | ||
tarrayapi | ||
compilerapi | ||
chainapi | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters