-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed logpdf(gp, y) to _logpdf(gp, y) to respect Distributions.jl A…
…PI and add Turing compatibility test (#52) * Renamed logpdf(gp, y) to _logpdf(gp, y) to resepect Distributions.jl API * Limit _logpdf to vectors and add specific methods for matrices * Correct behaviour for `loglikelihood` * Making product on y a scalar and removing _logpdf! * Returned docs and restored definition of logpdf for _logpdf * Missing docs * Correct typo on docs Co-authored-by: David Widmann <[email protected]> * Removing linebreak Co-authored-by: willtebbutt <[email protected]> * Adding tests for loglikelihood * Added a simple test with a Turing model * Adding Turing to test/Project.toml * Fixing Turing test * Modified syntax Turing test and changed test_nowarn to test * Added a test for the presence of docs * Bump patch version Co-authored-by: David Widmann <[email protected]> Co-authored-by: willtebbutt <[email protected]>
- Loading branch information
1 parent
617d217
commit ee483a4
Showing
6 changed files
with
47 additions
and
6 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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
name = "AbstractGPs" | ||
uuid = "99985d1d-32ba-4be9-9821-2ec096f28918" | ||
authors = ["willtebbutt <[email protected]>"] | ||
version = "0.2.7" | ||
version = "0.2.8" | ||
|
||
|
||
[deps] | ||
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" | ||
|
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@testset "turing compat" begin | ||
k = SqExponentialKernel() | ||
y = randn(3) | ||
X = randn(3, 1) | ||
x = [rand(1) for _ in 1:3] | ||
@model function GPRegression(y, X) | ||
# Priors. | ||
α ~ LogNormal(0.0, 0.1) | ||
ρ ~ LogNormal(0.0, 1.0) | ||
σ² ~ LogNormal(0.0, 1.0) | ||
|
||
# Realized covariance function | ||
kernel = α * transform(SqExponentialKernel(), 1 / ρ) | ||
f = GP(kernel) | ||
|
||
# Sampling Distribution. | ||
y ~ f(X, σ²) | ||
end | ||
# Test for matrices | ||
m = GPRegression(y, RowVecs(X)) | ||
@test length(sample(m, HMC(0.5, 1), 5)) == 5 | ||
# Test for vectors of vector | ||
m = GPRegression(y, x) | ||
@test length(sample(m, HMC(0.5, 1), 5)) == 5 | ||
end |
ee483a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
ee483a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/20985
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: