Skip to content

Commit

Permalink
Merge branch 'xKDR:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushpatnaikgit authored Oct 21, 2024
2 parents 8bfbbfb + 6488b11 commit 03af97f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: '1.7.2'
version: '1.7.3'
arch: x64
- name: Install test dependencies
run: julia --project=test/ -e 'using Pkg; Pkg.instantiate()'
- name: Run tests
run: julia --project=. -e 'using Pkg; Pkg.test()'
run: julia --project=. -e 'using Pkg; Pkg.test()'
7 changes: 4 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
[compat]
DataFrames = "1"
Distributions = "0.25"
Documenter = "0.27"
Documenter = "0.27, 1"
GLM = "1"
HypothesisTests = "0.11"
NLSolversBase = "7"
Optim = "1"
StatsAPI = "1"
StatsBase = "0.33"
StatsBase = "0.33, 0.34"
StatsModels = "0.6"
Turing = "0.23.2, 0.24"
Turing = "0.23.2, 0.24, 0.32, 0.34"
julia = "1"

[extras]
Expand Down
8 changes: 4 additions & 4 deletions test/numerical/bayesian/LinearRegression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ tests = [
for (prior, test_mean) in tests
CRRao.set_rng(StableRNG(123))
model = fit(@formula(MPG ~ HP + WT + Gear), mtcars, LinearRegression(), prior)

@test mean(predict(model, mtcars)) test_mean
prediction = predict(model, mtcars)
@test mean(prediction) - 2 * std(prediction) <= test_mean && test_mean <= mean(prediction) + 2 * std(prediction)
end

gauss_test = 20.0796026428345

CRRao.set_rng(StableRNG(123))
model = fit(@formula(MPG ~ HP + WT + Gear), mtcars, LinearRegression(), Prior_Gauss(), 30.0, [0.0,-3.0,1.0], 1000)

@test mean(predict(model, mtcars)) gauss_test
prediction = predict(model, mtcars)
@test mean(prediction) - 2 * std(prediction) <= gauss_test && gauss_test <= mean(prediction) + 2 * std(prediction)
4 changes: 2 additions & 2 deletions test/numerical/bayesian/LogisticRegression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ for (prior, prior_testcases) in tests
for (link, test_mean) in prior_testcases
CRRao.set_rng(StableRNG(123))
model = fit(@formula(Vote ~ Age + Race + Income + Educate), turnout, LogisticRegression(), link, prior)

@test mean(predict(model, turnout)) test_mean
prediction = predict(model, turnout)
@test mean(prediction) - 2 * std(prediction) <= test_mean && test_mean <= mean(prediction) + 2 * std(prediction)
end
end
4 changes: 2 additions & 2 deletions test/numerical/bayesian/NegBinomialRegression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ tests = [
for (prior, test_mean) in tests
CRRao.set_rng(StableRNG(123))
model = fit(@formula(Num ~ Target + Coop + NCost), sanction, NegBinomRegression(), prior)

@test mean(predict(model, sanction)) test_mean
prediction = predict(model, sanction)
@test mean(prediction) - 2 * std(prediction) <= test_mean && test_mean <= mean(prediction) + 2 * std(prediction)
end
4 changes: 2 additions & 2 deletions test/numerical/bayesian/PoissonRegression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ tests = [
for (prior, test_mean) in tests
CRRao.set_rng(StableRNG(123))
model = fit(@formula(Num ~ Target + Coop + NCost), sanction, PoissonRegression(), prior)

@test mean(predict(model, sanction)) test_mean
prediction = predict(model, sanction)
@test mean(prediction) - 2 * std(prediction) <= test_mean && test_mean <= mean(prediction) + 2 * std(prediction)
end

0 comments on commit 03af97f

Please sign in to comment.