Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into GChisq
Browse files Browse the repository at this point in the history
  • Loading branch information
heliosdrm committed Jan 22, 2025
2 parents 3ab5b06 + c6442a6 commit 0bd3aca
Show file tree
Hide file tree
Showing 92 changed files with 1,272 additions and 422 deletions.
35 changes: 14 additions & 21 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: CI

on:
pull_request:
branches:
- master
push:
branches:
- master
tags: '*'
workflow_dispatch:
merge_group:

concurrency:
# Skip intermediate builds: always.
Expand All @@ -17,38 +17,28 @@ concurrency:

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.version == 'nightly' }}
strategy:
fail-fast: false
matrix:
version:
- '1.3'
- '1'
- 'nightly'
- pre
os:
- ubuntu-latest
- macos-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v3
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
# ARM64 on macos-latest is neither supported by older Julia versions nor setup-julia
arch: ${{ matrix.os == 'macos-latest' && matrix.version != '1.3' && 'aarch64' || 'x64' }}
show-versioninfo: true
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- run: |
Expand All @@ -57,17 +47,20 @@ jobs:
Pkg.instantiate()'
- run: julia --project=perf perf/samplers.jl
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
fail_ci_if_error: true
files: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: '1'
show-versioninfo: true
- run: |
julia --project=docs -e '
using Pkg
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/IntegrationTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: 1
arch: x64
Expand Down
18 changes: 16 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name = "Distributions"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
authors = ["JuliaStats"]
version = "0.25.103"
version = "0.25.117"

[deps]
AliasTables = "66dad0bd-aa9a-41b7-9441-69ab47430ed8"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
DensityInterface = "b429d917-457f-4dbc-8f4c-0cc954292b1d"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Expand All @@ -30,15 +31,27 @@ DistributionsDensityInterfaceExt = "DensityInterface"
DistributionsTestExt = "Test"

[compat]
AliasTables = "1"
Aqua = "0.8"
Calculus = "0.5"
ChainRulesCore = "1"
ChainRulesTestUtils = "1"
DensityInterface = "0.4"
Distributed = "<0.0.1, 1"
FillArrays = "0.9, 0.10, 0.11, 0.12, 0.13, 1"
FiniteDifferences = "0.12"
ForwardDiff = "0.10"
JSON = "0.21"
LinearAlgebra = "<0.0.1, 1"
OffsetArrays = "1"
PDMats = "0.10, 0.11"
Printf = "<0.0.1, 1"
QuadGK = "2"
Random = "<0.0.1, 1"
SparseArrays = "<0.0.1, 1"
SpecialFunctions = "1.2, 2"
StableRNGs = "1"
StaticArrays = "1"
Statistics = "1"
StatsAPI = "1.6"
StatsBase = "0.32, 0.33, 0.34"
Expand All @@ -47,6 +60,7 @@ Test = "<0.0.1, 1"
julia = "1.3"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ChainRulesTestUtils = "cdddcdb0-9152-4a09-a978-84456f9df70a"
Expand All @@ -62,4 +76,4 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["StableRNGs", "Calculus", "ChainRulesCore", "ChainRulesTestUtils", "DensityInterface", "Distributed", "FiniteDifferences", "ForwardDiff", "JSON", "SparseArrays", "StaticArrays", "Test", "OffsetArrays"]
test = ["Aqua", "StableRNGs", "Calculus", "ChainRulesCore", "ChainRulesTestUtils", "DensityInterface", "Distributed", "FiniteDifferences", "ForwardDiff", "JSON", "SparseArrays", "StaticArrays", "Test", "OffsetArrays"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Distributions.jl
[![Build Status](https://github.com/JuliaStats/Distributions.jl/workflows/CI/badge.svg)](https://github.com/JuliaStats/Distributions.jl/actions)
[![](https://zenodo.org/badge/DOI/10.5281/zenodo.2647458.svg)](https://zenodo.org/record/2647458)
[![Coverage Status](https://coveralls.io/repos/JuliaStats/Distributions.jl/badge.svg?branch=master)](https://coveralls.io/r/JuliaStats/Distributions.jl?branch=master)
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaStats.github.io/Distributions.jl/latest/)
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaStats.github.io/Distributions.jl/stable/)
Expand Down
4 changes: 2 additions & 2 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"

[compat]
Documenter = "0.26, 0.27"
GR = "0.72.1"
Documenter = "1"
GR = "0.72.1, 0.73"
8 changes: 5 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Documenter, Distributions
import Random: AbstractRNG, rand!

makedocs(
makedocs(;
sitename = "Distributions.jl",
modules = [Distributions],
format = Documenter.HTML(; prettyurls = get(ENV, "CI", nothing) == "true"),
Expand All @@ -17,16 +17,18 @@ makedocs(
"reshape.md",
"cholesky.md",
"mixture.md",
"product.md",
"order_statistics.md",
"convolution.md",
"fit.md",
"extends.md",
"density_interface.md",
]
],
warnonly = true,
)

deploydocs(;
repo = "github.com/JuliaStats/Distributions.jl.git",
versions = ["stable" => "v^", "v#.#", "dev" => "master"],
push_preview=true,
push_preview = true,
)
2 changes: 2 additions & 0 deletions docs/src/fit.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ The function `fit_mle` is for maximum likelihood estimation.
### Synopsis

```@docs
fit(D, x)
fit(D, x, w)
fit_mle(D, x)
fit_mle(D, x, w)
```
Expand Down
10 changes: 0 additions & 10 deletions docs/src/multivariate.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ MvNormalCanon
MvLogitNormal
MvLogNormal
Dirichlet
Product
```

## Addition Methods
Expand Down Expand Up @@ -105,15 +104,6 @@ params{D<:Distributions.AbstractMvLogNormal}(::Type{D},m::AbstractVector,S::Abst
Distributions._logpdf(d::MultivariateDistribution, x::AbstractArray)
```

## Product distributions

```@docs
Distributions.product_distribution
```

Using `product_distribution` is advised to construct product distributions.
For some distributions, it constructs a special multivariate type.

## Index

```@index
Expand Down
27 changes: 27 additions & 0 deletions docs/src/product.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Product Distributions

Product distributions are joint distributions of multiple independent distributions.
It is recommended to use `product_distribution` to construct product distributions.
Depending on the type of the argument, it may construct a different distribution type.

## Multivariate products

```@docs
Distributions.product_distribution(::AbstractArray{<:Distribution{<:ArrayLikeVariate}})
Distributions.product_distribution(::AbstractVector{<:Normal})
Distributions.ProductDistribution
Distributions.Product
```

## NamedTuple-variate products

```@docs
Distributions.product_distribution(::NamedTuple{<:Any,<:Tuple{Distribution,Vararg{Distribution}}})
Distributions.ProductNamedTupleDistribution
```

## Index

```@index
Pages = ["product.md"]
```
7 changes: 5 additions & 2 deletions src/Distributions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import PDMats: dim, PDMat, invquad
using SpecialFunctions
using Base.MathConstants: eulergamma

import AliasTables

export
# re-export Statistics
mean, median, quantile, std, var, cov, cor,
Expand All @@ -39,6 +41,7 @@ export
Multivariate,
Matrixvariate,
CholeskyVariate,
NamedTupleVariate,
Discrete,
Continuous,
Sampleable,
Expand Down Expand Up @@ -128,7 +131,6 @@ export
MatrixBeta,
MatrixFDist,
MatrixNormal,
MatrixReshaped,
MatrixTDist,
MixtureModel,
Multinomial,
Expand Down Expand Up @@ -296,6 +298,7 @@ include("univariates.jl")
include("edgeworth.jl")
include("multivariates.jl")
include("matrixvariates.jl")
include("namedtuple/productnamedtuple.jl")
include("cholesky/lkjcholesky.jl")
include("samplers.jl")

Expand Down Expand Up @@ -366,7 +369,7 @@ Supported distributions:
NoncentralF, NoncentralHypergeometric, NoncentralT, Normal, NormalCanon,
NormalInverseGaussian, Pareto, PGeneralizedGaussian, Poisson, PoissonBinomial,
QQPair, Rayleigh, Rician, Skellam, Soliton, StudentizedRange, SymTriangularDist, TDist, TriangularDist,
Triweight, Truncated, TruncatedNormal, Uniform, UnivariateGMM,
Triweight, Truncated, Uniform, UnivariateGMM,
VonMises, VonMisesFisher, WalleniusNoncentralHypergeometric, Weibull,
Wishart, ZeroMeanIsoNormal, ZeroMeanIsoNormalCanon,
ZeroMeanDiagNormal, ZeroMeanDiagNormalCanon, ZeroMeanFullNormal,
Expand Down
1 change: 1 addition & 0 deletions src/censored.jl
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ _in_open_interval(x::Real, l::Real, ::Nothing) = x > l
_clamp(x, l, u) = clamp(x, l, u)
_clamp(x, ::Nothing, u) = min(x, u)
_clamp(x, l, ::Nothing) = max(x, l)
_clamp(x, ::Nothing, u::Nothing) = x

_to_truncated(d::Censored) = truncated(d.uncensored, d.lower, d.upper)

Expand Down
7 changes: 6 additions & 1 deletion src/cholesky/lkjcholesky.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ function insupport(d::LKJCholesky, R::LinearAlgebra.Cholesky)
return true
end

function StatsBase.mode(d::LKJCholesky)
function mode(d::LKJCholesky; check_args::Bool=true)
@check_args(
LKJCholesky,
@setup= d.η),
(η, η > 1, "mode is defined only when η > 1."),
)
factors = Matrix{eltype(d)}(LinearAlgebra.I, size(d))
return LinearAlgebra.Cholesky(factors, d.uplo, 0)
end
Expand Down
Loading

0 comments on commit 0bd3aca

Please sign in to comment.