Skip to content

Commit

Permalink
Add AbstractModel implementation of LogDensityProblems interface (#110)
Browse files Browse the repository at this point in the history
* added AbstractModel implementing the interface of LogDensityProblems

* version bump and add LogDensityProblems as a dep

* Update Project.toml

Co-authored-by: David Widmann <[email protected]>

* removed forwarding of methods for LogDensityModel

* Apply suggestions from code review

Co-authored-by: David Widmann <[email protected]>

* bump julia compat to 1.6

Co-authored-by: David Widmann <[email protected]>
  • Loading branch information
torfjelde and devmotion committed Dec 19, 2022
1 parent 6ef1dcb commit 18ea3f1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
version:
- '1.3'
- '1.6'
- '1'
- nightly
os:
Expand All @@ -31,7 +31,7 @@ jobs:
arch: x86
- os: macOS-latest
arch: x86
- version: '1.3'
- version: '1.6'
num_threads: 2
include:
- version: '1'
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
keywords = ["markov chain monte carlo", "probablistic programming"]
license = "MIT"
desc = "A lightweight interface for common MCMC methods."
version = "4.1.3"
version = "4.2"

[deps]
BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"
Expand All @@ -25,7 +25,7 @@ ProgressLogging = "0.1"
StatsBase = "0.32, 0.33"
TerminalLoggers = "0.1"
Transducers = "0.4.30"
julia = "1.3"
julia = "1.6"

[extras]
Atom = "c52e3926-4ff0-5f6e-af25-54175e0327b1"
Expand Down
1 change: 1 addition & 0 deletions src/AbstractMCMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ include("interface.jl")
include("sample.jl")
include("stepper.jl")
include("transducer.jl")
include("logdensityproblems.jl")

end # module AbstractMCMC
15 changes: 15 additions & 0 deletions src/logdensityproblems.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
LogDensityModel <: AbstractMCMC.AbstractModel
Wrapper around something that implements the LogDensityProblem.jl interface.
Note that this does _not_ implement the LogDensityProblems.jl interface itself,
but it simply useful for indicating to the `sample` and other `AbstractMCMC` methods
that the wrapped object implements the LogDensityProblems.jl interface.
# Fields
- `logdensity`: The object that implements the LogDensityProblems.jl interface.
"""
struct LogDensityModel{L} <: AbstractModel
logdensity::L
end

2 comments on commit 18ea3f1

@yebai
Copy link
Member

@yebai yebai commented on 18ea3f1 Dec 19, 2022

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/74348

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 v4.2.0 -m "<description of version>" 18ea3f156e93177ac3bc0c6504232a334ad7ee83
git push origin v4.2.0

Please sign in to comment.