JuliaStats / Distributions.jl

A Julia package for probability distributions and associated functions.
Other
1.08k stars 410 forks source link

Create a compact `show` for `MvNormal`. #1786

Open Vilin97 opened 9 months ago

Vilin97 commented 9 months ago

Create an MvNormal distribution:

julia> using LinearAlgebra, Distributions

julia> dist = MvNormal(I(2)) # plaintext unchanged
MvNormal{Bool, PDMats.PDiagMat{Bool, Vector{Bool}}, FillArrays.Falses{1, Tuple{Base.OneTo{Int64}}}}(
dim: 2
μ: Zeros{Bool}(2)
Σ: Bool[1 0; 0 1]
)

Before:

julia> "$dist"
"MvNormal{Bool, PDMats.PDiagMat{Bool, Vector{Bool}}, FillArrays.Falses{1, Tuple{Base.OneTo{Int64}}}}(\ndim: 2\nμ: Zeros{Bool}(2)\nΣ: Bool[1 0; 0 1]\n)\n"

After:

julia> "$dist" # nice compact representation
"MvNormal(Zeros{Bool}(2), Bool[1 0; 0 1])"
codecov-commenter commented 9 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Files Coverage Δ
src/multivariate/mvnormal.jl 73.59% <50.00%> (-4.39%) :arrow_down:

... and 133 files with indirect coverage changes

:loudspeaker: Thoughts on this report? Let us know!.

Vilin97 commented 9 months ago

@devmotion , I'm not sure who is the right person to ping, sorry. Let me know if this is a kind of change that you would be open to. This closes my issue https://github.com/JuliaStats/Distributions.jl/issues/1785.