Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
style = "blue"
33 changes: 20 additions & 13 deletions .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
name: Docs
name: Documentation

on:
push:
branches:
- master
- master # update to match your development branch (master, main, dev, trunk, ...)
tags: '*'
pull_request:

jobs:
docs:
name: Documentation
build:
# These permissions are needed to:
# - Deploy the documentation: https://documenter.juliadocs.org/stable/man/hosting/#Permissions
# - Delete old caches: https://github.com/julia-actions/cache#usage
permissions:
actions: write
contents: write
pull-requests: read
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- name: Install dependencies, build and deploy
- uses: julia-actions/cache@v2
- name: Install dependencies
shell: julia --color=yes --project=docs {0}
run: |
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
include(joinpath(pwd(), "docs", "make.jl"))
- name: Build and deploy
run: julia --color=yes --project=docs docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
GKSwstype: nul # turn off GR's interactive plotting for notebooks
JULIA_PKG_SERVER: ''
shell: julia --color=yes --project=docs/ {0}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
Expand All @@ -38,6 +38,8 @@ jobs:
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v5
with:
file: lcov.info
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ 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.9.0

This version is largely a tidying up job. It simplies much of the test suite, bumps the
required version to Julia LTS. It additionally drops the various ChainRules that were
implemented, in favour of assuming that users make use of a more powerful AD system than was
available when this package was originally written. For example, you may wish to make use of
Mooncake to differentiate code in this package.

### Breaking Changes

Removal of dependency on ChainRulesCore.jl, and associated rules. This means that this
package almost certainly no longer supports Zygote.jl, but achieves a great reduction in the
amount of testing which much be performed.

## 0.8.0

### Breaking Changes
Expand Down
25 changes: 14 additions & 11 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
name = "Stheno"
uuid = "8188c328-b5d6-583d-959b-9690869a5511"
version = "0.8.2"
version = "0.9.0"

[deps]
AbstractGPs = "99985d1d-32ba-4be9-9821-2ec096f28918"
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
KernelFunctions = "ec8451be-7e33-11e9-00cf-bbf324bd1392"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"

[compat]
AbstractGPs = "0.4, 0.5"
BlockArrays = "0.15, 0.16"
ChainRulesCore = "1"
KernelFunctions = "0.9.6, 0.10"
MacroTools = "0.4, 0.5"
Reexport = "0.2, 1"
julia = "1.3"
AbstractGPs = "0.5"
BlockArrays = "1"
KernelFunctions = "0.10"
MacroTools = "0.5"
Test = "1"
julia = "1.10"

[extras]
KernelFunctions = "ec8451be-7e33-11e9-00cf-bbf324bd1392"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["KernelFunctions", "Test"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ See the docs for more examples.

## Hyperparameter learning and inference

Fortunately, there is really no need for this package to explicitly provide support for hyperparameter optimisation as the functionality is already available elsewhere -- it's sufficient that it plays nicely with other standard packages in the ecosystem such as [Zygote.jl](https://github.com/FluxML/Zygote.jl/) (reverse-mode algorithmic differentiation), [Optim.jl](https://github.com/JuliaNLSolvers/Optim.jl) (non-linear optimisation), [AdvancedHMC.jl](https://github.com/TuringLang/AdvancedHMC.jl/) (Hamiltonian Monte Carlo / NUTS), [ParameterHandling.jl](https://github.com/invenia/ParameterHandling.jl/), [Soss.jl](https://github.com/cscherrer/Soss.jl/) / [Turing.jl](https://github.com/TuringLang/Turing.jl). For concrete examples of the use of each of these packages in conjunction with Stheno, see the `Getting Started` section of the [(dev) docs](https://juliagaussianprocesses.github.io/Stheno.jl/dev).
Fortunately, there is really no need for this package to explicitly provide support for hyperparameter optimisation as the functionality is already available elsewhere -- it's sufficient that it plays nicely with other standard packages in the ecosystem such as [Mooncake.jl](https://github.com/compintell/Mooncake.jl/) (reverse-mode algorithmic differentiation), [Optim.jl](https://github.com/JuliaNLSolvers/Optim.jl) (non-linear optimisation), [AdvancedHMC.jl](https://github.com/TuringLang/AdvancedHMC.jl/) (Hamiltonian Monte Carlo / NUTS), [ParameterHandling.jl](https://github.com/invenia/ParameterHandling.jl/), [Soss.jl](https://github.com/cscherrer/Soss.jl/) / [Turing.jl](https://github.com/TuringLang/Turing.jl). For concrete examples of the use of each of these packages in conjunction with Stheno, see the `Getting Started` section of the [(dev) docs](https://juliagaussianprocesses.github.io/Stheno.jl/dev).



Expand Down
10 changes: 6 additions & 4 deletions bench/gp/abstract_gp.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
@benchset "abstract_gp" begin
for N in [10,]
for N in [10]
f = GP(CustomMean(sin), SEKernel(), GPC())
x = randn(N)
fx = f(x)
y = rand(fx)
@benchset "N=$N" begin
create_benchmarks("logpdf SEKernel $N (x, y)", true, (x, y)->logpdf(f(x), y), x, y)
create_benchmarks("rand SEKernel $N", true, x->rand(f(x)), x)
create_benchmarks("cov(f(x)) $N", true, x->cov(f(x)), x)
create_benchmarks(
"logpdf SEKernel $N (x, y)", true, (x, y) -> logpdf(f(x), y), x, y
)
create_benchmarks("rand SEKernel $N", true, x -> rand(f(x)), x)
create_benchmarks("cov(f(x)) $N", true, x -> cov(f(x)), x)
end
end
end
11 changes: 9 additions & 2 deletions bench/mean_and_kernel/compose.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
using Stheno: UnaryMean, BinaryMean, BinaryKernel, BinaryCrossKernel, LhsCross, RhsCross,
OuterCross, OuterKernel
using Stheno:
UnaryMean,
BinaryMean,
BinaryKernel,
BinaryCrossKernel,
LhsCross,
RhsCross,
OuterCross,
OuterKernel

@benchset "compose" begin
let
Expand Down
10 changes: 5 additions & 5 deletions bench/mean_and_kernel/finite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
μ = FiniteMean(CustomMean(sin), randn(N))
@benchset(
"CustomMean(sin) $N",
create_benchmarks(μ; grads=false, x=1, x̄s=[1:N-1, 1:N,]),
create_benchmarks(μ; grads=false, x=1, x̄s=[1:(N - 1), 1:N]),
)
end
end
Expand All @@ -13,7 +13,7 @@
k = FiniteKernel(SEKernel(), randn(N))
@benchset(
"SEKernel() $N",
create_benchmarks(k; grads=false, x=1, x′=2, x̄s=[1:N,], x̄′s=[1:N,]),
create_benchmarks(k; grads=false, x=1, x′=2, x̄s=[1:N], x̄′s=[1:N]),
)
end
end
Expand All @@ -22,7 +22,7 @@
k = LhsFiniteCrossKernel(SEKernel(), randn(N))
@benchset(
"SEKernel() $N",
create_benchmarks(k; grads=false, x=1, x′=2.0, x̄s=[1:N,], x̄′s=[randn(N),]),
create_benchmarks(k; grads=false, x=1, x′=2.0, x̄s=[1:N], x̄′s=[randn(N)]),
)
end
end
Expand All @@ -31,7 +31,7 @@
k = RhsFiniteCrossKernel(SEKernel(), randn(N))
@benchset(
"SEKernel() $N",
create_benchmarks(k; grads=false, x=1.0, x′=2, x̄s=[randn(N),], x̄′s=[1:N,]),
create_benchmarks(k; grads=false, x=1.0, x′=2, x̄s=[randn(N)], x̄′s=[1:N]),
)
end
end
Expand All @@ -40,7 +40,7 @@
k = FiniteCrossKernel(SEKernel(), randn(N), randn(N))
@benchset(
"SEKernel() $N",
create_benchmarks(k; grads=false, x=1, x′=2, x̄s=[1:N,], x̄′s=[1:N,]),
create_benchmarks(k; grads=false, x=1, x′=2, x̄s=[1:N], x̄′s=[1:N]),
)
end
end
Expand Down
13 changes: 6 additions & 7 deletions bench/mean_and_kernel/kernel.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@benchset "kernel" begin

@benchset "ZeroKernel{Float64}()" begin
create_benchmarks(ZeroKernel{Float64}(); grads=false)
end
Expand All @@ -8,12 +7,12 @@
# end
# @benchset "SEKernel" begin
# @benchset "Real CPU" create_benchmarks(SEKernel())
# @benchset "Real GPU" create_benchmarks(
# SEKernel();
# x=randn(Float32), x′=randn(Float32),
# x̄s=[CuArray{Float32}(randn(N)) for N in Ns()],
# x̄′s=[CuArray{Float32}(randn(N)) for N in Ns()],
# )
# @benchset "Real GPU" create_benchmarks(
# SEKernel();
# x=randn(Float32), x′=randn(Float32),
# x̄s=[CuArray{Float32}(randn(N)) for N in Ns()],
# x̄′s=[CuArray{Float32}(randn(N)) for N in Ns()],
# )

# for D in Ds()
# @benchset "ColVecs (D=$D) CPU" create_benchmarks(
Expand Down
4 changes: 0 additions & 4 deletions bench/misc/ad_perf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const x2 = randn(25)

@model foo(θ) = GP(ConstMean(θ.m), kernel(SEKernel(); l=θ.l));



#
# Test single-process versions of operations on foo.
#
Expand All @@ -29,8 +27,6 @@ y = rand(foo(θ)(x, 0.1));
@code_warntype logpdf(foo(θ)(x, 0.1), y)
@benchmark logpdf(foo($θ)($x, 0.1), $y)



#
# Test multi-process versions of operations on foo.
#
Expand Down
6 changes: 3 additions & 3 deletions bench/runbenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ benchmarks = @benchset "Stheno" begin

# @benchset "mean_and_kernel" begin
# include("mean_and_kernel/mean.jl")
include("mean_and_kernel/kernel.jl")
# include("mean_and_kernel/compose.jl")
# include("mean_and_kernel/finite.jl")
include("mean_and_kernel/kernel.jl")
# include("mean_and_kernel/compose.jl")
# include("mean_and_kernel/finite.jl")
# end

# @benchset "gp" begin
Expand Down
36 changes: 23 additions & 13 deletions bench/util.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Ns() = [1_000,]
Ns() = [1_000]
# Ns() = [10,]
Ds() = [1,]
Ds() = [1]

generate_x̄s(x, x̄s::Nothing) = [fill(x, N) for N in Ns()]
generate_x̄s(x, x̄s) = x̄s
Expand All @@ -27,19 +27,25 @@ function create_benchmarks(μ::MeanFunction; grads=true, x=5.0, x̄s=nothing)

for x̄ in generate_x̄s(x, x̄s)
N = length(x̄)
create_benchmarks("map ($(length(x̄)))", grads, x->map(μ, x), x̄)
create_benchmarks("map ($(length(x̄)))", grads, x -> map(μ, x), x̄)
end
end

# Common benchmarks for CrossKernel.
function create_benchmarks(k::CrossKernel; x=5.0, x′=4.0, x̄s=nothing, x̄′s=nothing, grads=true)
function create_benchmarks(
k::CrossKernel; x=5.0, x′=4.0, x̄s=nothing, x̄′s=nothing, grads=true
)
create_benchmarks("k(x, x′)", grads, k, x, x′)

for (x̄, x̄′) in zip(generate_x̄s(x, x̄s), generate_x̄s(x′, x̄′s))
N = length(x̄)
@benchset "$N" begin
create_benchmarks("map k(x̄, x̄′) $N", grads, (x̄, x̄′)->map(k, x̄, x̄′), x̄, x̄′)
create_benchmarks("pw k(x̄, x̄′) $N", grads, (x̄, x̄′)->pairwise(k, x̄, x̄′), x̄, x̄′)
create_benchmarks(
"map k(x̄, x̄′) $N", grads, (x̄, x̄′) -> map(k, x̄, x̄′), x̄, x̄′
)
create_benchmarks(
"pw k(x̄, x̄′) $N", grads, (x̄, x̄′) -> pairwise(k, x̄, x̄′), x̄, x̄′
)
end
end
end
Expand All @@ -52,27 +58,31 @@ function create_benchmarks(k::Kernel; x=5.0, x′=4.0, x̄s=nothing, x̄′s=not
for (x̄, x̄′) in zip(generate_x̄s(x, x̄s), generate_x̄s(x′, x̄′s))
N = length(x̄)
@benchset "$N" begin
create_benchmarks("map k(x̄) $N", grads, x̄->map(k, x̄), x̄)
create_benchmarks("map k(x̄, x̄′) $N", grads, (x̄, x̄′)->map(k, x̄, x̄′), x̄, x̄′)
create_benchmarks("pw k(x̄) $N", grads, x̄->pairwise(k, x̄), x̄)
create_benchmarks("pw k(x̄, x̄′) $N", grads, (x̄, x̄′)->pairwise(k, x̄, x̄′), x̄, x̄′)
create_benchmarks("map k(x̄) $N", grads, x̄ -> map(k, x̄), x̄)
create_benchmarks(
"map k(x̄, x̄′) $N", grads, (x̄, x̄′) -> map(k, x̄, x̄′), x̄, x̄′
)
create_benchmarks("pw k(x̄) $N", grads, x̄ -> pairwise(k, x̄), x̄)
create_benchmarks(
"pw k(x̄, x̄′) $N", grads, (x̄, x̄′) -> pairwise(k, x̄, x̄′), x̄, x̄′
)
end
end
end

function pretty_print(d::BenchmarkGroup, pre=1)
pretty_print(d.data, pre)
return pretty_print(d.data, pre)
end

function pretty_print(d::Dict, pre=1)
for (k, v) in d
if v isa BenchmarkGroup
s = "$(repr(k))"
println(join(fill(" ", pre)) * s)
pretty_print(v, pre+1+4)
pretty_print(v, pre + 1 + 4)
else
println(join(fill(" ", pre)) * "$(repr(k)) => $(repr(v))")
end
end
nothing
return nothing
end
6 changes: 3 additions & 3 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Stheno = "8188c328-b5d6-583d-959b-9690869a5511"

[compat]
Documenter = "0.27"
julia = "1.6"
Stheno = "0.8"
Documenter = "1"
julia = "1.10"
Pkg = "1"
Loading