JuliaAI / ScientificTypes.jl

An API for dispatching on the "scientific" type of data instead of the machine type
MIT License
96 stars 8 forks source link

Implement `scitype` for Distributions: Sampleable, Distribution #143

Closed ablaom closed 3 years ago

ablaom commented 3 years ago

This PR overloads scitype to return appropriately parameterised versions of the new scitypes Sampleable{K} and Density{K} for objects with type <: Distributions.Sampleable:

julia> d = Distributions.MultivariateNormal(3, 1.0)
ZeroMeanIsoNormal(
dim: 3
μ: Zeros(3)
Σ: [1.0 0.0 0.0; 0.0 1.0 0.0; 0.0 0.0 1.0]
)

julia> scitype(d)
Density{AbstractVector{Continuous}}

Currently UnivariateFinite distributions from MLJBase will have scitype Density{Unknown} because their VariateType is currently defined in MLJBase. I'm not aware of a simple solution that is not also breaking and propose postponing this until UnivariateFinite is migrated to it's own package.

codecov-commenter commented 3 years ago

Codecov Report

Merging #143 (ddae7af) into dev (e72b6c8) will decrease coverage by 2.31%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #143      +/-   ##
==========================================
- Coverage   96.85%   94.53%   -2.32%     
==========================================
  Files           7        7              
  Lines         286      293       +7     
==========================================
  Hits          277      277              
- Misses          9       16       +7     
Impacted Files Coverage Δ
src/ScientificTypes.jl 100.00% <ø> (ø)
src/convention/scitype.jl 78.37% <0.00%> (-18.29%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e72b6c8...ddae7af. Read the comment docs.