diff --git a/Project.toml b/Project.toml index fb6afa3..fec7c34 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ConsistencyResampling" uuid = "4937dc1f-c7a3-5772-9d42-4a8277f2eb51" authors = ["David Widmann "] -version = "0.3.0" +version = "0.3.1" [deps] Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" diff --git a/docs/Manifest.toml b/docs/Manifest.toml index bc97faa..c768134 100644 --- a/docs/Manifest.toml +++ b/docs/Manifest.toml @@ -17,9 +17,9 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" [[ChainRulesCore]] deps = ["Compat", "LinearAlgebra", "SparseArrays"] -git-tree-sha1 = "42e3c181483fbd2c416087a0a93838803e358358" +git-tree-sha1 = "a66109c73612c63b10923ac446fddb0f0d21a593" uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" -version = "0.9.38" +version = "0.9.40" [[Compat]] deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] @@ -35,7 +35,7 @@ uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" deps = ["Random", "StatsBase"] path = ".." uuid = "4937dc1f-c7a3-5772-9d42-4a8277f2eb51" -version = "0.2.1" +version = "0.3.0" [[DataAPI]] git-tree-sha1 = "dfb3b7e89e395be1e25c2ad6d7690dc29cc53b1d" @@ -67,9 +67,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[Distributions]] deps = ["FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns"] -git-tree-sha1 = "a837fdf80f333415b69684ba8e8ae6ba76de6aaa" +git-tree-sha1 = "36aa8125c8caa6a449b54d5d45ac97afd392549d" uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" -version = "0.24.18" +version = "0.25.0" [[DocStringExtensions]] deps = ["LibGit2", "Markdown", "Pkg", "Test"] @@ -252,10 +252,10 @@ uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" uuid = "6462fe0b-24de-5631-8697-dd941f90decc" [[SortingAlgorithms]] -deps = ["DataStructures", "Random", "Test"] -git-tree-sha1 = "03f5898c9959f8115e30bc7226ada7d0df554ddd" +deps = ["DataStructures"] +git-tree-sha1 = "2ec1962eba973f383239da22e75218565c390a96" uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" -version = "0.3.1" +version = "1.0.0" [[SparseArrays]] deps = ["LinearAlgebra", "Random"] @@ -271,11 +271,16 @@ version = "1.3.0" deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +[[StatsAPI]] +git-tree-sha1 = "1958272568dc176a1d881acb797beb909c785510" +uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" +version = "1.0.0" + [[StatsBase]] -deps = ["DataAPI", "DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics"] -git-tree-sha1 = "4d8ca45223d7a28839e775d73a6f6b6b2ac64fd1" +deps = ["DataAPI", "DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] +git-tree-sha1 = "2f6792d523d7448bbe2fec99eca9218f06cc746d" uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" -version = "0.33.6" +version = "0.33.8" [[StatsFuns]] deps = ["LogExpFunctions", "Rmath", "SpecialFunctions"] diff --git a/docs/Project.toml b/docs/Project.toml index eb8476a..5f6fe7a 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -6,7 +6,7 @@ StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" [compat] ConsistencyResampling = "0.3" -Distributions = "0.24" +Distributions = "0.25" Documenter = "0.26" StructArrays = "0.5" julia = "1" diff --git a/docs/src/supported.md b/docs/src/supported.md index 66b189d..91ed597 100644 --- a/docs/src/supported.md +++ b/docs/src/supported.md @@ -92,16 +92,6 @@ predictions = map(Normal, randn(100), rand(100)) nothing #hide ``` -Unfortunately, currently Distributions does not define `Random.Sampler` and therefore we have -to implement it to be able to perform consistency resampling: - -```@example distribution -using Random - -Random.Sampler(::Type{<:AbstractRNG}, s::Sampleable, ::Val{1}) = s -Random.Sampler(::Type{<:AbstractRNG}, s::Sampleable, ::Val{Inf}) = sampler(s) -``` - Consistency resampling yields a randomly sampled prediction and a sample from it. ```@example distribution @@ -111,3 +101,15 @@ prediction, target = rand(Consistent(predictions)) ```@example distribution prediction in predictions ``` + +!!! note + This example requires Distributions >= 0.25.0. Older versions of Distributions did not + define `Random.Sampler` and therefore you have to implement it yourself to be able to + perform consistency resampling: + ```julia + using Distributions + using Random + + Random.Sampler(::Type{<:AbstractRNG}, s::Sampleable, ::Val{1}) = s + Random.Sampler(::Type{<:AbstractRNG}, s::Sampleable, ::Val{Inf}) = sampler(s) + ``` diff --git a/test/Project.toml b/test/Project.toml index e26c4d2..83dcfb4 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -9,7 +9,7 @@ StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] -Distributions = "0.24" +Distributions = "0.25" Documenter = "0.26" StatsBase = "0.33" StructArrays = "0.5" diff --git a/test/runtests.jl b/test/runtests.jl index b47d790..58f17eb 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,10 +17,6 @@ using Test Random.seed!(1234) -# Distributions.jl does not implement the Random API -Random.Sampler(::Type{<:AbstractRNG}, s::Sampleable, ::Val{1}) = s -Random.Sampler(::Type{<:AbstractRNG}, s::Sampleable, ::Val{Inf}) = sampler(s) - @testset "ConsistencyResampling" begin @testset "Alias sampler" begin include("alias.jl")