-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into namedtuplevariate
- Loading branch information
Showing
14 changed files
with
87 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ jobs: | |
version: | ||
- '1.3' | ||
- '1' | ||
- pre | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
test_cgf(Chisq(1), (0.49, -1, -100, -1f6)) | ||
test_cgf(Chisq(3), (0.49, -1, -100, -1f6)) | ||
|
||
@testset "Chisq" begin | ||
test_cgf(Chisq(1), (0.49, -1, -100, -1.0f6)) | ||
test_cgf(Chisq(3), (0.49, -1, -100, -1.0f6)) | ||
|
||
for T in (Float32, Float64) | ||
@test @inferred(rand(Chisq(T(1)))) isa T | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
|
||
test_cgf(Exponential(1), (0.9, -1, -100f0, -1e6)) | ||
test_cgf(Exponential(0.91), (0.9, -1, -100f0, -1e6)) | ||
test_cgf(Exponential(10 ), (0.08, -1, -100f0, -1e6)) | ||
@testset "Exponential" begin | ||
test_cgf(Exponential(1), (0.9, -1, -100f0, -1e6)) | ||
test_cgf(Exponential(0.91), (0.9, -1, -100f0, -1e6)) | ||
test_cgf(Exponential(10 ), (0.08, -1, -100f0, -1e6)) | ||
|
||
for T in (Float32, Float64) | ||
@test @inferred(rand(Exponential(T(1)))) isa T | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
using Test, Distributions, OffsetArrays | ||
|
||
test_cgf(Gamma(1 ,1 ), (0.9, -1, -100f0, -1e6)) | ||
test_cgf(Gamma(10 ,1 ), (0.9, -1, -100f0, -1e6)) | ||
test_cgf(Gamma(0.2, 10), (0.08, -1, -100f0, -1e6)) | ||
@testset "Gamma" begin | ||
test_cgf(Gamma(1, 1), (0.9, -1, -100.0f0, -1e6)) | ||
test_cgf(Gamma(10, 1), (0.9, -1, -100.0f0, -1e6)) | ||
test_cgf(Gamma(0.2, 10), (0.08, -1, -100.0f0, -1e6)) | ||
|
||
@testset "Gamma suffstats and OffsetArrays" begin | ||
a = rand(Gamma(), 11) | ||
wa = 1.0:11.0 | ||
@testset "Gamma suffstats and OffsetArrays" begin | ||
a = rand(Gamma(), 11) | ||
wa = 1.0:11.0 | ||
|
||
resulta = @inferred(suffstats(Gamma, a)) | ||
resulta = @inferred(suffstats(Gamma, a)) | ||
|
||
resultwa = @inferred(suffstats(Gamma, a, wa)) | ||
resultwa = @inferred(suffstats(Gamma, a, wa)) | ||
|
||
b = OffsetArray(a, -5:5) | ||
wb = OffsetArray(wa, -5:5) | ||
b = OffsetArray(a, -5:5) | ||
wb = OffsetArray(wa, -5:5) | ||
|
||
resultb = @inferred(suffstats(Gamma, b)) | ||
@test resulta == resultb | ||
resultb = @inferred(suffstats(Gamma, b)) | ||
@test resulta == resultb | ||
|
||
resultwb = @inferred(suffstats(Gamma, b, wb)) | ||
@test resultwa == resultwb | ||
resultwb = @inferred(suffstats(Gamma, b, wb)) | ||
@test resultwa == resultwb | ||
|
||
@test_throws DimensionMismatch suffstats(Gamma, a, wb) | ||
@test_throws DimensionMismatch suffstats(Gamma, a, wb) | ||
end | ||
|
||
for T in (Float32, Float64) | ||
@test @inferred(rand(Gamma(T(1), T(1)))) isa T | ||
@test @inferred(rand(Gamma(1/T(2), T(1)))) isa T | ||
@test @inferred(rand(Gamma(T(2), T(1)))) isa T | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@testset "InverseGaussian cdf outside of [0, 1] (#1873)" begin | ||
for d in [ | ||
InverseGaussian(1.65, 590), | ||
InverseGaussian(0.5, 1000) | ||
] | ||
for x in [0.02, 1.0, 20.0, 300.0] | ||
p = cdf(d, x) | ||
@test 0.0 <= p <= 1.0 | ||
@test p ≈ exp(logcdf(d, x)) | ||
|
||
q = ccdf(d, x) | ||
@test 0.0 <= q <= 1.0 | ||
@test q ≈ exp(logccdf(d, x)) | ||
|
||
@test (p + q) ≈ 1 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters