Skip to content

Commit 6b8820e

Browse files
authored
Fix autocorplot on Julia 1.10 and update compat entries (#448)
* Update compat entries * Fix? * Update definition * Fix * Update Project.toml * Revert optional change * Revert last commit
1 parent 4d2a2f4 commit 6b8820e

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

Project.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uuid = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
33
keywords = ["markov chain monte carlo", "probablistic programming"]
44
license = "MIT"
55
desc = "Chain types and utility functions for MCMC simulations."
6-
version = "6.0.4"
6+
version = "6.0.5"
77

88
[deps]
99
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
@@ -30,16 +30,20 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
3030
[compat]
3131
AbstractMCMC = "0.4, 0.5, 1.0, 2.0, 3.0, 4, 5"
3232
AxisArrays = "0.4.4"
33+
Dates = "<0.0.1, 1"
3334
Distributions = "0.21, 0.22, 0.23, 0.24, 0.25"
3435
Formatting = "0.4"
3536
IteratorInterfaceExtensions = "0.1.1, 1"
3637
KernelDensity = "0.6.2"
38+
LinearAlgebra = "<0.0.1, 1"
3739
MCMCDiagnosticTools = "0.3"
3840
MLJModelInterface = "0.3.5, 0.4, 1.0"
3941
NaturalSort = "1"
4042
OrderedCollections = "1.4"
4143
PrettyTables = "0.9, 0.10, 0.11, 0.12, 1, 2"
44+
Random = "<0.0.1, 1"
4245
RecipesBase = "0.7, 0.8, 1.0"
46+
Statistics = "<0.0.1, 1"
4347
StatsBase = "0.33.2, 0.34"
4448
StatsFuns = "0.8, 0.9, 1"
4549
TableTraits = "0.4, 1"

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MLJDecisionTreeInterface = "c6f25543-311c-4c74-83dc-3ea6d1015661"
1010
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
1111

1212
[compat]
13-
CairoMakie = "0.6, 0.7, 0.8, 0.9, 0.10"
13+
CairoMakie = "0.6, 0.7, 0.8, 0.9, 0.10, 0.11"
1414
CategoricalArrays = "0.8, 0.9, 0.10"
1515
DataFrames = "0.22, 1"
1616
Documenter = "0.26, 0.27, 1"

src/plot.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const supportedplots = push!(collect(keys(translationdict)), :mixeddensity, :cor
6464
lags = 0:(maxlag === nothing ? round(Int, 10 * log10(length(range(c)))) : maxlag)
6565
# Chains are already appended in `c` if desired, hence we use `append_chains=false`
6666
ac = autocor(c; sections = nothing, lags = lags, append_chains=false)
67-
ac_mat = convert(Array, ac)
67+
ac_mat = convert(Array{Float64}, ac)
6868
val = colordim == :parameter ? ac_mat[:, :, i]' : ac_mat[i, :, :]
6969
_AutocorPlot(lags, val)
7070
elseif st supportedplots

src/summarize.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ function Base.lastindex(c::ChainDataFrame, i::Integer)
104104
end
105105
end
106106

107-
function Base.convert(::Type{Array}, c::C) where C<:ChainDataFrame
107+
function Base.convert(::Type{Array}, c::ChainDataFrame)
108108
T = promote_eltype_namedtuple_tail(c.nt)
109+
return convert(Array{T}, c)
110+
end
111+
function Base.convert(::Type{Array{T}}, c::ChainDataFrame) where {T}
109112
arr = Array{T, 2}(undef, c.nrows, c.ncols - 1)
110113

111114
for (i, k) in enumerate(Iterators.drop(keys(c.nt), 1))
@@ -115,9 +118,13 @@ function Base.convert(::Type{Array}, c::C) where C<:ChainDataFrame
115118
return arr
116119
end
117120

118-
function Base.convert(::Type{Array}, cs::Array{ChainDataFrame{T},1}) where T<:NamedTuple
121+
function Base.convert(::Type{Array}, cs::Vector{ChainDataFrame{NamedTuple{K,V}}}) where {K,V}
122+
T = promote_eltype_tuple_type(Base.tuple_type_tail(V))
123+
return convert(Array{T}, cs)
124+
end
125+
function Base.convert(::Type{Array{T}}, cs::Vector{<:ChainDataFrame}) where {T}
119126
return mapreduce((x, y) -> cat(x, y; dims = Val(3)), cs) do c
120-
reshape(convert(Array, c), Val(3))
127+
reshape(convert(Array{T}, c), Val(3))
121128
end
122129
end
123130

test/Project.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1111
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
1212
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
1313
MLJDecisionTreeInterface = "c6f25543-311c-4c74-83dc-3ea6d1015661"
14-
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1514
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1615
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
1716
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
@@ -25,17 +24,22 @@ UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
2524
[compat]
2625
AbstractMCMC = "2.2.1, 3.0, 4, 5"
2726
DataFrames = "0.22.4, 1.0"
27+
Dates = "<0.0.1, 1"
2828
Distributions = "0.24.12, 0.25"
2929
Documenter = "0.26, 0.27, 1"
3030
FFTW = "1.1"
3131
IteratorInterfaceExtensions = "1"
3232
KernelDensity = "0.6.2"
33+
Logging = "<0.0.1, 1"
3334
MCMCChains = "6"
3435
MLJBase = "0.18, 0.19, 0.20, 0.21, 1"
3536
MLJDecisionTreeInterface = "0.3, 0.4"
37+
Random = "<0.0.1, 1"
38+
Serialization = "<0.0.1, 1"
3639
StatsBase = "0.33.2, 0.34"
3740
StatsPlots = "0.14.17, 0.15"
3841
TableTraits = "1"
3942
Tables = "1.3.1"
43+
Test = "<0.0.1, 1"
4044
UnicodePlots = "2, 3"
4145
julia = "1.6"

0 commit comments

Comments
 (0)