Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
```
Running tests:
1 ambiguities found. To get a list, set `broken = false`.
Ambiguity JuliaStats#1
frule(::ChainRulesCore.RuleConfig, args...) in ChainRulesCore at /home/runner/.julia/packages/ChainRulesCore/I1EbV/src/rules.jl:64
frule(::Any, ::typeof(Distributions.logpdf), d::Distributions.Uniform, x::Real) in Distributions.DistributionsChainRulesCoreExt at /home/runner/work/Distributions.jl/Distributions.jl/ext/DistributionsChainRulesCoreExt/univariate/continuous/uniform.jl:1

Possible fix, define
  frule(::ChainRulesCore.RuleConfig, ::typeof(Distributions.logpdf), ::Distributions.Uniform, ::Real)

Aqua: Test Failed at /home/runner/.julia/packages/Aqua/tHrmY/src/ambiguities.jl:78
  Expression: iszero(num_ambiguities)
Stacktrace:
 [1] macro expansion
   @ /opt/hostedtoolcache/julia/1.8.5/x64/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
 [2] _test_ambiguities(packages::Vector{Base.PkgId}; broken::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Aqua ~/.julia/packages/Aqua/tHrmY/src/ambiguities.jl:78
```

```
pdf/logpdf: Error During Test at /Users/runner/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:76
  Test threw exception
  Expression: #= /Users/runner/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:76 =# @inferred(logpdf(d, x)) isa T
  DomainError with -0.31736627:
  log will only return a complex result if called with a complex argument. Try log(Complex(x)).
  Stacktrace:
    [1] throw_complex_domainerror(f::Symbol, x::Float32)
      @ Base.Math ./math.jl:33
    [2] _log(x::Float32, base::Val{:ℯ}, func::Symbol)
      @ Base.Math ./special/log.jl:336
    [3] log
      @ ./special/log.jl:264 [inlined]
    [4] log1mexp
      @ ~/.julia/packages/LogExpFunctions/X95j7/src/basicfuns.jl:240 [inlined]
    [5] logdiffcdf(d::Uniform{Float32}, x::Float32, y::Float32)
      @ Distributions ~/work/Distributions.jl/Distributions.jl/src/univariates.jl:372
    [6] _marginalize_range
      @ ~/work/Distributions.jl/Distributions.jl/src/multivariate/jointorderstatistics.jl:125 [inlined]
    [7] logpdf(d::JointOrderStatistics{Uniform{Float32}, Tuple{Int64, Int64, Int64}}, x::Vector{Float32})
      @ Distributions ~/work/Distributions.jl/Distributions.jl/src/multivariate/jointorderstatistics.jl:111
    [8] macro expansion
      @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
    [9] macro expansion
      @ ~/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:76 [inlined]
   [10] macro expansion
      @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:1363 [inlined]
   [11] macro expansion
      @ ~/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:75 [inlined]
   [12] macro expansion
      @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:1439 [inlined]
   [13] macro expansion
      @ ~/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:35 [inlined]
   [14] macro expansion
      @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:1363 [inlined]
   [15] top-level scope
      @ ~/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:4
   [16] include
      @ ./client.jl:476 [inlined]
   [17] macro expansion
      @ ~/work/Distributions.jl/Distributions.jl/test/runtests.jl:175 [inlined]
   [18] macro expansion
      @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:1439 [inlined]
   [19] macro expansion
      @ ~/work/Distributions.jl/Distributions.jl/test/runtests.jl:174 [inlined]
   [20] macro expansion
      @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:1363 [inlined]
   [21] top-level scope
      @ ~/work/Distributions.jl/Distributions.jl/test/runtests.jl:174
   [22] include(fname::String)
      @ Base.MainInclude ./client.jl:476
   [23] top-level scope
      @ none:6
   [24] eval
      @ ./boot.jl:368 [inlined]
   [25] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:276
   [26] _start()
      @ Base ./client.jl:522
```
  • Loading branch information
LebedevRI committed Sep 18, 2024
1 parent b219803 commit 578d068
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
name: CI

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


concurrency:
# Skip intermediate builds: always.
Expand All @@ -23,13 +17,26 @@ jobs:
fail-fast: false
matrix:
version:
- '1.3'
- '1'
- '1.10'
- '1.9'
- '1.8'
- '1.7'
- '1.6'
- pre
os:
- ubuntu-latest
- macos-latest
- windows-latest
include:
- version: '1.7'
os: macos-12
- version: '1.6'
os: macos-12
exclude:
- version: '1.7'
os: macos-latest
- version: '1.6'
os: macos-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
Expand All @@ -47,11 +54,6 @@ jobs:
Pkg.instantiate()'
- run: julia --project=perf perf/samplers.jl
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
fail_ci_if_error: true
files: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
Expand Down
5 changes: 1 addition & 4 deletions test/aqua.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ import Aqua
Aqua.test_all(
Distributions;
ambiguities = false,
# On older Julia versions, installed dependencies are quite old
# Thus unbound type parameters show up that are fixed in newer versions
unbound_args = VERSION >= v"1.6",
)
# Tests are not reliable on older Julia versions and
# show ambiguities in loaded packages
if VERSION >= v"1.6"
if VERSION >= v"1.9"
Aqua.test_ambiguities(Distributions)
end
end
6 changes: 2 additions & 4 deletions test/testutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ function test_cgf(dist, ts)
d(f) = Base.Fix1(ForwardDiff.derivative, f)
κ₁ = d(Base.Fix1(cgf, dist))(0)
@test κ₁ mean(dist)
if VERSION >= v"1.4"
κ₂ = d(d(Base.Fix1(cgf, dist)))(0)
@test κ₂ var(dist)
end
κ₂ = d(d(Base.Fix1(cgf, dist)))(0)
@test κ₂ var(dist)
for t in ts
val = @inferred cgf(dist, t)
@test isfinite(val)
Expand Down
10 changes: 7 additions & 3 deletions test/univariate/continuous/uniform.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ using StatsFuns
using Random
using Test

Random.seed!(34567)

rng = MersenneTwister(123)

@testset "uniform.jl" begin
# affine transformations
test_affine_transformations(Uniform, rand(), 4 + rand())
test_affine_transformations(Uniform, rand(rng), 4 + rand(rng))
test_cgf(Uniform(0,1), (1, -1, 100f0, 1e6, -1e6))
test_cgf(Uniform(100f0,101f0), (1, -1, 100f0, 1e6, -1e6))

@testset "ChainRules" begin
# run test suite for values in the support
dist = Uniform(- 1 - rand(), 1 + rand())
dist = Uniform(- 1 - rand(rng), 1 + rand(rng))
tangent = ChainRulesTestUtils.Tangent{Uniform{Float64}}(; a=randn(), b=randn())
for x in (rand(), -rand())
for x in (rand(rng), -rand(rng))
test_frule(logpdf, dist tangent, x)
test_rrule(logpdf, dist tangent, x)
end
Expand Down

0 comments on commit 578d068

Please sign in to comment.