Skip to content

Commit 5f9592f

Browse files
authored
Merge branch 'main' into qqy/NEW_RMHMC
2 parents 1fcdd09 + 5a562e0 commit 5f9592f

File tree

19 files changed

+177
-85
lines changed

19 files changed

+177
-85
lines changed

.github/workflows/CI.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
actions: write
2020
contents: read
2121
runs-on: ${{ matrix.os }}
22-
continue-on-error: ${{ matrix.version == 'pre' }}
22+
continue-on-error: ${{ matrix.version == 'pre' || matrix.version == 'min' }}
2323
strategy:
2424
matrix:
2525
version:
@@ -30,12 +30,6 @@ jobs:
3030
- ubuntu-latest
3131
- macOS-latest
3232
- windows-latest
33-
exclude:
34-
- version: 'min'
35-
os: macOS-latest # Apple Silicon
36-
include:
37-
- version: 'min'
38-
os: macOS-13 # Intel
3933
steps:
4034
- uses: actions/checkout@v4
4135
- uses: julia-actions/setup-julia@v2
@@ -47,3 +41,9 @@ jobs:
4741
uses: julia-actions/julia-runtest@v1
4842
env:
4943
AHMC_TEST_GROUP: AdvancedHMC
44+
- uses: julia-actions/julia-processcoverage@v1
45+
- uses: codecov/codecov-action@v5
46+
with:
47+
files: lcov.info
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
fail_ci_if_error: true

HISTORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## 0.8.0
44

55
- To make an MCMC transtion from phasepoint `z` using trajectory `τ`(or HMCKernel `κ`) under Hamiltonian `h`, use `transition(h, τ, z)` or `transition(rng, h, τ, z)`(if using HMCKernel, use `transition(h, κ, z)` or `transition(rng, h, κ, z)`).
6+
- The `initial_step_size` in `find_good_stepsize` for heuristic search of a good initial leap-frog step-size can be manually specified, default as `1//10`.
7+
- The printing interface has been upgraded to a more user-friendly design.
68

79
## v0.7.1
810

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@ StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
1818

1919
[weakdeps]
2020
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
21-
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
2221
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
22+
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
2323
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
2424
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
2525

2626
[extensions]
2727
AdvancedHMCADTypesExt = "ADTypes"
28-
AdvancedHMCComponentArraysExt = "ComponentArrays"
2928
AdvancedHMCCUDAExt = "CUDA"
29+
AdvancedHMCComponentArraysExt = "ComponentArrays"
3030
AdvancedHMCMCMCChainsExt = "MCMCChains"
3131
AdvancedHMCOrdinaryDiffEqExt = "OrdinaryDiffEq"
3232

3333
[compat]
3434
ADTypes = "1"
3535
AbstractMCMC = "5.6"
3636
ArgCheck = "1, 2"
37-
ComponentArrays = "0.15"
3837
CUDA = "3, 4, 5"
38+
ComponentArrays = "0.15"
3939
DocStringExtensions = "0.8, 0.9"
4040
LinearAlgebra = "<0.1, 1"
4141
LogDensityProblems = "2"
4242
LogDensityProblemsAD = "1"
43-
MCMCChains = "5, 6"
43+
MCMCChains = "5, 6, 7"
4444
OrdinaryDiffEq = "6"
4545
ProgressMeter = "1"
4646
Random = "<0.1, 1"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![CI](https://github.com/TuringLang/AdvancedHMC.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/TuringLang/AdvancedHMC.jl/actions/workflows/CI.yml)
44
[![DOI](https://zenodo.org/badge/72657907.svg)](https://zenodo.org/badge/latestdoi/72657907)
5-
[![Coverage Status](https://coveralls.io/repos/github/TuringLang/AdvancedHMC.jl/badge.svg?branch=main)](https://coveralls.io/github/TuringLang/AdvancedHMC.jl?branch=main)
5+
[![Coverage Status](https://codecov.io/gh/TuringLang/AdvancedHMC.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/TuringLang/AdvancedHMC.jl)
66
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://turinglang.github.io/AdvancedHMC.jl/stable/)
77
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://turinglang.github.io/AdvancedHMC.jl/dev/)
88
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![CI](https://github.com/TuringLang/AdvancedHMC.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/TuringLang/AdvancedHMC.jl/actions/workflows/CI.yml)
44
[![DOI](https://zenodo.org/badge/72657907.svg)](https://zenodo.org/badge/latestdoi/72657907)
5-
[![Coverage Status](https://coveralls.io/repos/github/TuringLang/AdvancedHMC.jl/badge.svg?branch=kx%2Fbug-fix)](https://coveralls.io/github/TuringLang/AdvancedHMC.jl?branch=kx%2Fbug-fix)
5+
[![Coverage Status](https://codecov.io/gh/TuringLang/AdvancedHMC.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/TuringLang/AdvancedHMC.jl)
66
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://turinglang.github.io/AdvancedHMC.jl/stable/)
77
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://turinglang.github.io/AdvancedHMC.jl/dev/)
88
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

ext/AdvancedHMCADTypesExt.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
module AdvancedHMCADTypesExt
22

3-
using AdvancedHMC:
4-
AbstractMetric, LogDensityModel, Hamiltonian, LogDensityProblems, LogDensityProblemsAD
3+
using AdvancedHMC: AdvancedHMC, AbstractMetric, Hamiltonian, LogDensityModel
4+
using AdvancedHMC: LogDensityProblems, LogDensityProblemsAD
55
using ADTypes: AbstractADType
66

7-
function Hamiltonian(
7+
function AdvancedHMC.Hamiltonian(
88
metric::AbstractMetric, ℓπ::LogDensityModel, kind::AbstractADType; kwargs...
99
)
1010
return Hamiltonian(metric, ℓπ.logdensity, kind; kwargs...)
1111
end
12-
function Hamiltonian(metric::AbstractMetric, ℓπ, kind::AbstractADType; kwargs...)
12+
function AdvancedHMC.Hamiltonian(
13+
metric::AbstractMetric, ℓπ, kind::AbstractADType; kwargs...
14+
)
1315
if LogDensityProblems.capabilities(ℓπ) === nothing
1416
throw(
1517
ArgumentError(

research/tests/Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
AdaptiveRejectionSampling = "c75e803d-635f-53bd-ab7d-544e482d8c75"
33
AdvancedHMC = "0bf59076-c3b1-5ca4-86bd-e02cd72cde3d"
44
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
5-
Comonicon = "863f3e99-da2a-4334-8734-de3dacbe5542"
65
DiffResults = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
76
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
87
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"

research/tests/runtests.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
using Comonicon, ReTest
1+
using ReTest
22

33
# include the source code for experimental HMC
44
include("../src/relativistic_hmc.jl")
55

66
# include the tests for experimental HMC
77
include("relativistic_hmc.jl")
88

9-
Comonicon.@main function runtests(patterns...; dry::Bool=false)
10-
return retest(patterns...; dry=dry, verbose=Inf)
11-
end
9+
retest(; dry=false, verbose=Inf)

src/adaptation/Adaptation.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ struct NaiveHMCAdaptor{M<:MassMatrixAdaptor,Tssa<:StepSizeAdaptor} <: AbstractAd
3737
pc::M
3838
ssa::Tssa
3939
end
40-
function Base.show(io::IO, a::NaiveHMCAdaptor)
41-
return print(io, "NaiveHMCAdaptor(pc=$(a.pc), ssa=$(a.ssa))")
40+
function Base.show(io::IO, ::MIME"text/plain", a::NaiveHMCAdaptor)
41+
return print(io, "NaiveHMCAdaptor(pc=", a.pc, ", ssa=", a.ssa, ")")
4242
end
4343

4444
getM⁻¹(ca::NaiveHMCAdaptor) = getM⁻¹(ca.pc)

src/adaptation/massmatrix.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ end
2323

2424
struct UnitMassMatrix{T<:AbstractFloat} <: MassMatrixAdaptor end
2525

26-
Base.show(io::IO, ::UnitMassMatrix) = print(io, "UnitMassMatrix")
26+
function Base.show(io::IO, mime::MIME"text/plain", ::UnitMassMatrix{T}) where {T}
27+
return print(io, "UnitMassMatrix{", T, "} adaptor")
28+
end
2729

2830
UnitMassMatrix() = UnitMassMatrix{Float64}()
2931

@@ -91,7 +93,9 @@ mutable struct WelfordVar{T<:AbstractFloat,E<:AbstractVecOrMat{T},V<:AbstractVec
9193
end
9294
end
9395

94-
Base.show(io::IO, ::WelfordVar) = print(io, "WelfordVar")
96+
function Base.show(io::IO, mime::MIME"text/plain", ::WelfordVar{T}) where {T}
97+
return print(io, "WelfordVar{", T, "} adaptor")
98+
end
9599

96100
function WelfordVar{T}(
97101
sz::Union{Tuple{Int},Tuple{Int,Int}}; n_min::Int=10, var=ones(T, sz)
@@ -190,7 +194,9 @@ mutable struct WelfordCov{F<:AbstractFloat,C<:AbstractMatrix{F}} <: DenseMatrixE
190194
cov::C
191195
end
192196

193-
Base.show(io::IO, ::WelfordCov) = print(io, "WelfordCov")
197+
function Base.show(io::IO, mime::MIME"text/plain", ::WelfordCov{T}) where {T}
198+
return print(io, "WelfordCov{", T, "} adaptor")
199+
end
194200

195201
function WelfordCov{T}(
196202
sz::Tuple{Int}; n_min::Int=10, cov=LinearAlgebra.diagm(0 => ones(T, first(sz)))

0 commit comments

Comments
 (0)