Skip to content

Commit 6c6fc70

Browse files
committed
Update README
1 parent 411a356 commit 6c6fc70

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,34 +75,35 @@ supported methods are `Array{Proposal}`, `Proposal`, and `NamedTuple{Proposal}`.
7575
```julia
7676
# Provide a univariate proposal.
7777
m1 = DensityModel(x -> logpdf(Normal(x,1), 1.0))
78-
p1 = Proposal(Static(), Normal(0,1))
78+
p1 = StaticProposal(Normal(0,1))
7979
c1 = sample(m1, MetropolisHastings(p1), 100; chain_type=Vector{NamedTuple})
8080

8181
# Draw from a vector of distributions.
8282
m2 = DensityModel(x -> logpdf(Normal(x[1], x[2]), 1.0))
83-
p2 = Proposal(Static(), [Normal(0,1), InverseGamma(2,3)])
83+
p2 = StaticProposal([Normal(0,1), InverseGamma(2,3)])
8484
c2 = sample(m2, MetropolisHastings(p2), 100; chain_type=Vector{NamedTuple})
8585

8686
# Draw from a `NamedTuple` of distributions.
8787
m3 = DensityModel(x -> logpdf(Normal(x.a, x.b), 1.0))
88-
p3 = (a=Proposal(Static(), Normal(0,1)), b=Proposal(Static(), InverseGamma(2,3)))
88+
p3 = (a=StaticProposal(Normal(0,1)), b=StaticProposal(InverseGamma(2,3)))
8989
c3 = sample(m3, MetropolisHastings(p3), 100; chain_type=Vector{NamedTuple})
9090

9191
# Draw from a functional proposal.
9292
m4 = DensityModel(x -> logpdf(Normal(x,1), 1.0))
93-
p4 = Proposal(Static(), (x=1.0) -> Normal(x, 1))
93+
p4 = StaticProposal((x=1.0) -> Normal(x, 1))
9494
c4 = sample(m4, MetropolisHastings(p4), 100; chain_type=Vector{NamedTuple})
9595
```
9696

9797
## Static vs. Random Walk
9898

9999
Currently there are only two methods of inference available. Static MH simply draws from the prior, with no
100100
conditioning on the previous sample. Random walk will add the proposal to the previously observed value.
101-
If you are constructing a `Proposal` by hand, you can determine whether the proposal is `Static` or `RandomWalk` using
101+
If you are constructing a `Proposal` by hand, you can determine whether the proposal is a
102+
`StaticProposal` or a `RandomWalkProposal` using
102103

103104
```julia
104-
static_prop = Proposal(Static(), Normal(0,1))
105-
rw_prop = Proposal(RandomWalk(), Normal(0,1))
105+
static_prop = StaticProposal(Normal(0,1))
106+
rw_prop = RandomWalkProposal(Normal(0,1))
106107
```
107108

108109
Different methods are easily composeable. One parameter can be static and another can be a random walk,

0 commit comments

Comments
 (0)