Skip to content

Commit

Permalink
Update README.md and reexport MCMCSerial (#66)
Browse files Browse the repository at this point in the history
* Update README.md

* Reexport MCMCSerial

* Bump version

* Update README.md

Co-authored-by: Cameron Pfiffer <[email protected]>

Co-authored-by: Cameron Pfiffer <[email protected]>
  • Loading branch information
devmotion and cpfiffer authored Oct 20, 2021
1 parent 465c22d commit 361a669
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "AdvancedMH"
uuid = "5b7e9947-ddc0-4b3f-9b55-0d8042f74170"
version = "0.6.5"
version = "0.6.6"

[deps]
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,19 @@ rw_prop = RandomWalkProposal(Normal(0,1))
Different methods are easily composeable. One parameter can be static and another can be a random walk,
each of which may be drawn from separate distributions.

## Multithreaded sampling
## Multiple chains

AdvancedMH.jl implements the interface of [AbstractMCMC](https://github.com/TuringLang/AbstractMCMC.jl/), which means you get multiple chain sampling
in parallel for free:
AdvancedMH.jl implements the interface of [AbstractMCMC](https://github.com/TuringLang/AbstractMCMC.jl/) which means sampling of multiple chains is supported for free:

```julia
# Sample 4 chains from the posterior.
chain = psample(model, RWMH(init_params), 100000, 4; param_names=["μ","σ"], chain_type=Chains)
# Sample 4 chains from the posterior serially, without thread or process parallelism.
chain = sample(model, RWMH(init_params), MCMCSerial(), 100000, 4; param_names=["μ","σ"], chain_type=Chains)

# Sample 4 chains from the posterior using multiple threads.
chain = sample(model, RWMH(init_params), MCMCThreads(), 100000, 4; param_names=["μ","σ"], chain_type=Chains)

# Sample 4 chains from the posterior using multiple processes.
chain = sample(model, RWMH(init_params), MCMCDistributed(), 100000, 4; param_names=["μ","σ"], chain_type=Chains)
```

## Metropolis-adjusted Langevin algorithm (MALA)
Expand Down
2 changes: 1 addition & 1 deletion src/AdvancedMH.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export
MALA

# Reexports
export sample, MCMCThreads, MCMCDistributed
export sample, MCMCThreads, MCMCDistributed, MCMCSerial

# Abstract type for MH-style samplers. Needs better name?
abstract type MHSampler <: AbstractMCMC.AbstractSampler end
Expand Down

2 comments on commit 361a669

@devmotion
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/47134

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.6 -m "<description of version>" 361a66905947799d7945818862673d07d5568b16
git push origin v0.6.6

Please sign in to comment.