From 412a3e836515a56e5449818ff0d9800fabcf3044 Mon Sep 17 00:00:00 2001 From: Raphael-Tresor <40422324+Raphael-Tresor@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:22:35 +0200 Subject: [PATCH 1/2] isproper-bug-fix --- src/distributions/matrix_dirichlet.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/distributions/matrix_dirichlet.jl b/src/distributions/matrix_dirichlet.jl index 21e99da2..d3b39900 100644 --- a/src/distributions/matrix_dirichlet.jl +++ b/src/distributions/matrix_dirichlet.jl @@ -116,9 +116,9 @@ end # Natural parametrization isproper(::NaturalParametersSpace, ::Type{MatrixDirichlet}, η, conditioner) = - isnothing(conditioner) && length(η) > 1 && typeof(isqrt(length(η))) <: Integer && all(isless.(-1, η)) && all(!isinf, η) && all(!isnan, η) + isnothing(conditioner) && length(η) > 1 && all(isless.(-1, η)) && all(!isinf, η) && all(!isnan, η) isproper(::MeanParametersSpace, ::Type{MatrixDirichlet}, θ, conditioner) = - isnothing(conditioner) && length(θ) > 1 && typeof(isqrt(length(θ))) <: Integer && all(>(0), θ) && all(!isinf, θ) && all(!isnan, θ) + isnothing(conditioner) && length(θ) > 1 &&all(>(0), θ) && all(!isinf, θ) && all(!isnan, θ) function (::MeanToNatural{MatrixDirichlet})(tuple_of_θ::Tuple{Any}) (α,) = tuple_of_θ From a40f396cf22be368cf05cfa2df0622687499d31f Mon Sep 17 00:00:00 2001 From: Raphael-Tresor <40422324+Raphael-Tresor@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:27:05 +0200 Subject: [PATCH 2/2] isproper-test-bug-fix --- test/distributions/matrix_dirichlet_tests.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/distributions/matrix_dirichlet_tests.jl b/test/distributions/matrix_dirichlet_tests.jl index 3fcf5249..c22b83ce 100644 --- a/test/distributions/matrix_dirichlet_tests.jl +++ b/test/distributions/matrix_dirichlet_tests.jl @@ -90,15 +90,14 @@ end end for space in (MeanParametersSpace(), NaturalParametersSpace()) - @test !isproper(space, MatrixDirichlet, [Inf Inf; Inf 1.0], 1.0) + @test !isproper(space, MatrixDirichlet, [Inf Inf; Inf 1.0]) @test !isproper(space, MatrixDirichlet, [1.0], Inf) - @test !isproper(space, MatrixDirichlet, [NaN], 1.0) + @test !isproper(space, MatrixDirichlet, [NaN],) @test !isproper(space, MatrixDirichlet, [1.0], NaN) @test !isproper(space, MatrixDirichlet, [0.5, 0.5], 1.0) @test isproper(space, MatrixDirichlet, [2.0, 3.0]) @test !isproper(space, MatrixDirichlet, [-1.0, -1.2]) - end - + end @test_throws Exception convert(ExponentialFamilyDistribution, MatrixDirichlet([Inf Inf; 2 3])) end