Skip to content

Commit

Permalink
Tidy up and deprecate approx_posterior (#218)
Browse files Browse the repository at this point in the history
* Remove redundant tests

* Deprecate approx_posterior

* Update NEWS

* Deprecate approx_posterior

* Bump patch
  • Loading branch information
willtebbutt authored Dec 27, 2021
1 parent c822896 commit f31a495
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 74 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ between versions, and discuss new features.
If you find a breaking change this is not reported here, please either raise an issue or
make a PR to ammend this document.

## 0.7.16
- Deprecate `approx_posterior` in favour of `posterior`. This is being removed because it has been removed in AbstractGPs in favour of `posterior`. It will be entirely removed in the next breaking release.
- Remove some redundant testing infrastructure and tidy up the file structure slightly.

## 0.7.15
Enable WrappedGP to work with any AbstractGP, not just the GP type.

## 0.7.14

AbstractGPs now takes care of everything sparsity-related.
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Stheno"
uuid = "8188c328-b5d6-583d-959b-9690869a5511"
version = "0.7.16"
version = "0.7.17"

[deps]
AbstractGPs = "99985d1d-32ba-4be9-9821-2ec096f28918"
Expand Down
4 changes: 2 additions & 2 deletions examples/gppp_and_pseudo_points/1d_additive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ scatter!(posterior_plot, x.x, y;
M3 = 25;
z = GPPPInput(:f3, collect(range(0, T; length=M3)));
u = f(z, 1e-9);
f′_approx = approx_posterior(VFE(), fx, y, u);
f′_approx = posterior(VFE(), fx, y, u);

@show elbo(fx, y, u);

Expand Down Expand Up @@ -118,7 +118,7 @@ z1 = GPPPInput(:f1, collect(range(0.0; step=1 / ω, length=M1)));
z2 = GPPPInput(:f2, collect(range(0.0; step=T, length=M2)));
z12 = BlockData(z1, z2);
u12 = f(z12, 1e-9);
f′_approx_12 = approx_posterior(VFE(), fx, y, u12);
f′_approx_12 = posterior(VFE(), fx, y, u12);

@show elbo(fx, y, u12);

Expand Down
2 changes: 1 addition & 1 deletion examples/pseudo_points/basic_operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ display(@benchmark elbo($fx, $y, $u))
println()

# Compute the approximate posterior process.
f_post = approx_posterior(VFE(), fx, y, u);
f_post = posterior(VFE(), fx, y, u);

# Specify some points at which to plot the approximate posterior.
Npr = 1000
Expand Down
3 changes: 1 addition & 2 deletions src/Stheno.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module Stheno
elbo,
dtc,
posterior,
approx_posterior,
marginals

using MacroTools: @capture, combinedef, postwalk, splitdef
Expand All @@ -36,7 +35,7 @@ module Stheno
# Various bits of utility that aren't inherently GP-related. Often very type-piratic.
include(joinpath("util", "zygote_rules.jl"))
include(joinpath("util", "covariance_matrices.jl"))
include(joinpath("util", "block_arrays", "dense.jl"))
include(joinpath("util", "dense.jl"))
include(joinpath("util", "abstract_data_set.jl"))
include(joinpath("util", "proper_type_piracy.jl"))

Expand Down
2 changes: 2 additions & 0 deletions src/deprecate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@

using KernelFunctions: NeuralKernelNetwork
export NeuralKernelNetwork

@deprecate approx_posterior posterior
4 changes: 2 additions & 2 deletions src/sparse_finite_gp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ A finite-dimensional projection of an `AbstractGP` `f` at locations `x`, which u
`FiniteGP` defined at a sparse set of inducing points [1] to do approximate inference.
This object has similar methods to an ordinary `FiniteGP`, but when you call `logpdf` on it,
it actually computes the `elbo`, and when you call `posterior` on it, `approx_posterior` is
called.
it actually computes the `elbo`, and when you call `posterior` on it, you get an approximate
posterior.
[1] - M. K. Titsias. "Variational learning of inducing variables in sparse Gaussian
processes". In: Proceedings of the Twelfth International Conference on Artificial
Expand Down
File renamed without changes.
5 changes: 1 addition & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ include("test_util.jl")
@timedtestset "util" begin
include(joinpath("util", "zygote_rules.jl"))
include(joinpath("util", "covariance_matrices.jl"))
@testset "block_arrays" begin
include(joinpath("util", "block_arrays", "test_util.jl"))
include(joinpath("util", "block_arrays", "dense.jl"))
end
include(joinpath("util", "dense.jl"))
include(joinpath("util", "abstract_data_set.jl"))
end

Expand Down
61 changes: 0 additions & 61 deletions test/util/block_arrays/test_util.jl

This file was deleted.

8 changes: 7 additions & 1 deletion test/util/block_arrays/dense.jl → test/util/dense.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@timedtestset "dense" begin

@timedtestset "fdm stuff" begin
rng, Ps, Qs = MersenneTwister(123456), [5, 4], [3, 2, 1]
X = mortar([randn(rng, P, Q) for P in Ps, Q in Qs], Ps, Qs)
vec_X, from_vec = FiniteDifferences.to_vec(X)
@test vec_X isa Vector
@test from_vec(vec_X) == X
end
@timedtestset "Stheno._collect ∘ mortar" begin
@timedtestset "BlockVector" begin

Expand Down

2 comments on commit f31a495

@willtebbutt
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

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/51286

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:

git tag -a v0.7.17 -m "<description of version>" f31a495141d1f2b6328b2967beccbe3da56d22a0
git push origin v0.7.17

Please sign in to comment.