Skip to content

Commit e99be16

Browse files
committed
Merge remote-tracking branch 'origin/main' into ck/maximum-likelihood
2 parents efe1573 + ff9b064 commit e99be16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1540
-1693
lines changed

.github/workflows/CompatHelper.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CompatHelper
2+
on:
3+
schedule:
4+
- cron: 0 0 * * *
5+
workflow_dispatch:
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
jobs:
10+
CompatHelper:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check if Julia is already available in the PATH
14+
id: julia_in_path
15+
run: which julia
16+
continue-on-error: true
17+
- name: Install Julia, but only if it is not already available in the PATH
18+
uses: julia-actions/setup-julia@v2
19+
with:
20+
version: '1'
21+
arch: ${{ runner.arch }}
22+
if: steps.julia_in_path.outcome != 'success'
23+
- name: "Add the General registry via Git"
24+
run: |
25+
import Pkg
26+
ENV["JULIA_PKG_SERVER"] = ""
27+
Pkg.Registry.add("General")
28+
shell: julia --color=yes {0}
29+
- name: "Install CompatHelper"
30+
run: |
31+
import Pkg
32+
name = "CompatHelper"
33+
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
34+
version = "3"
35+
Pkg.add(; name, uuid, version)
36+
shell: julia --color=yes {0}
37+
- name: "Run CompatHelper"
38+
run: |
39+
import CompatHelper
40+
CompatHelper.main(subdirs=["GeneralisedFilters", "SSMProblems"])
41+
shell: julia --color=yes {0}
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}

.github/workflows/DocsNav.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Rebuild docs with newest navbar
2+
3+
on:
4+
# 3:25 AM UTC every Sunday -- choose an uncommon time to avoid
5+
# periods of heavy GitHub Actions usage
6+
schedule:
7+
- cron: '25 3 * * 0'
8+
# Whenever needed
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
update-navbar:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout gh-pages branch
20+
uses: actions/checkout@v4
21+
with:
22+
ref: gh-pages
23+
24+
- name: Insert navbar
25+
uses: TuringLang/actions/DocsNav@main
26+
with:
27+
doc-path: '.'
28+
29+
- name: Commit and push changes
30+
run: |
31+
if [[ -n $(git status -s) ]]; then
32+
git config user.name github-actions[bot]
33+
git config user.email github-actions[bot]@users.noreply.github.com
34+
git add -A
35+
git commit -m "Update navbar (automated)"
36+
git push
37+
else
38+
echo "No changes to commit"
39+
fi

.github/workflows/Documentation.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags: ['*']
8+
pull_request:
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
14+
15+
jobs:
16+
docs:
17+
name: ${{ matrix.pkg.name }} Docs
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
statuses: write
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
pkg:
26+
- name: GeneralisedFilters
27+
dir: './GeneralisedFilters'
28+
- name: SSMProblems
29+
dir: './SSMProblems'
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: julia-actions/setup-julia@v2
34+
with:
35+
version: '1'
36+
- uses: julia-actions/cache@v1
37+
- name: Install dependencies
38+
run: julia --project=${{ matrix.pkg.dir }}/docs/ --color=yes -e '
39+
using Pkg;
40+
Pkg.Registry.update();
41+
Pkg.develop(PackageSpec(path="${{ matrix.pkg.dir }}"));
42+
if "${{ matrix.pkg.name }}" == "GeneralisedFilters"
43+
Pkg.develop(PackageSpec(path="./SSMProblems"));
44+
end;
45+
Pkg.instantiate();'
46+
- name: Build and deploy
47+
uses: TuringLang/actions/DocsDocumenter@main
48+
with:
49+
pkg_path: ${{ matrix.pkg.dir }}
50+
doc-path: ${{ matrix.pkg.dir }}/docs
51+
doc-make-path: ${{ matrix.pkg.dir }}/docs/make.jl
52+
doc-build-path: ${{ matrix.pkg.dir }}/docs/build
53+
dirname: ${{ matrix.pkg.name }}

.github/workflows/Format.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Format
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
format:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: julia-actions/setup-julia@latest
15+
with:
16+
version: 1
17+
- name: Format code
18+
run: |
19+
using Pkg
20+
Pkg.add(; name="JuliaFormatter", uuid="98e50ef6-434e-11e9-1051-2b60c6c9e899")
21+
using JuliaFormatter
22+
format("GeneralisedFilters"; verbose=true)
23+
format("SSMProblems"; verbose=true)
24+
shell: julia --color=yes {0}
25+
- uses: reviewdog/action-suggester@v1
26+
if: github.event_name == 'pull_request'
27+
with:
28+
tool_name: JuliaFormatter
29+
fail_on_error: true

.github/workflows/TagBot.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: TagBot
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
7+
inputs:
8+
lookback:
9+
default: "3"
10+
permissions:
11+
actions: read
12+
checks: read
13+
contents: write
14+
deployments: read
15+
issues: read
16+
discussions: read
17+
packages: read
18+
pages: read
19+
pull-requests: read
20+
repository-projects: read
21+
security-events: read
22+
statuses: read
23+
jobs:
24+
TagBot:
25+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Tag GeneralisedFilters
29+
uses: JuliaRegistries/TagBot@v1
30+
with:
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
ssh: ${{ secrets.DOCUMENTER_KEY }}
33+
subdir: GeneralisedFilters
34+
- name: Tag SSMProblems
35+
uses: JuliaRegistries/TagBot@v1
36+
with:
37+
token: ${{ secrets.GITHUB_TOKEN }}
38+
ssh: ${{ secrets.DOCUMENTER_KEY }}
39+
subdir: SSMProblems

Project.toml renamed to GeneralisedFilters/Project.toml

+8-3
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,25 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2121
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
2222

2323
[compat]
24+
AcceleratedKernels = "0.3"
25+
CUDA = "5"
26+
AbstractMCMC = "5"
2427
DataStructures = "0.18.20"
28+
Distributions = "0.25"
2529
GaussianDistributions = "0.5.2"
30+
HypothesisTests = "0.11"
31+
NNlib = "0.9"
32+
LogExpFunctions = "0.3"
2633
OffsetArrays = "1.14.1"
2734
Statistics = "1.11.1"
2835
StatsBase = "0.34.3"
2936

3037
[extras]
31-
HypothesisTests = "09f84164-cd44-5f33-b23f-e6b0d136a0d5"
32-
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
3338
PDMats = "90014a1f-27ba-587c-ab20-58faa44d9150"
3439
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
3540
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3641
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
3742
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"
3843

3944
[targets]
40-
test = ["HypothesisTests", "LinearAlgebra", "StableRNGs", "Test", "TestItemRunner", "TestItems", "PDMats"]
45+
test = ["PDMats", "StableRNGs", "Test", "TestItemRunner", "TestItems"]
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module GFTest
2+
3+
using CUDA
4+
using LinearAlgebra
5+
using NNlib
6+
using Random
7+
8+
using GeneralisedFilters
9+
using SSMProblems
10+
11+
include("utils.jl")
12+
include("models/linear_gaussian.jl")
13+
include("models/dummy_linear_gaussian.jl")
14+
15+
end

test/utils/models/dummy_linear_gaussian.jl renamed to GeneralisedFilters/src/GFTest/models/dummy_linear_gaussian.jl

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
dynamics, this model can be used in Rao-Blackwellised settings.
1515
"""
1616

17+
export InnerDynamics, create_dummy_linear_gaussian_model
18+
1719
"""
1820
Inner dynamics of the dummy linear Gaussian model.
1921
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function rand_cov(rng::AbstractRNG, T::Type{<:Real}, d::Int)
2+
Σ = rand(rng, T, d, d)
3+
return Σ * Σ'
4+
end

src/GeneralisedFilters.jl renamed to GeneralisedFilters/src/GeneralisedFilters.jl

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function instantiate end
2626

2727
# Default method
2828
function instantiate(model, alg, initial; kwargs...)
29-
return Intermediate(initial, deepcopy(initial))
29+
return Intermediate(initial, initial)
3030
end
3131

3232
"""
@@ -147,4 +147,7 @@ include("algorithms/kalman.jl")
147147
include("algorithms/forward.jl")
148148
include("algorithms/rbpf.jl")
149149

150+
# Unit-testing helper module
151+
include("GFTest/GFTest.jl")
152+
150153
end

src/algorithms/bootstrap.jl renamed to GeneralisedFilters/src/algorithms/bootstrap.jl

+4-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function step(
3232
end
3333

3434
struct BootstrapFilter{RS<:AbstractResampler} <: AbstractParticleFilter
35-
N::Integer
35+
N::Int
3636
resampler::RS
3737
end
3838

@@ -50,7 +50,7 @@ function instantiate(
5050
::StateSpaceModel{T}, filter::BootstrapFilter, initial; kwargs...
5151
) where {T}
5252
N = filter.N
53-
return ParticleIntermediate(initial, deepcopy(initial), Vector{Int}(undef, N))
53+
return ParticleIntermediate(initial, initial, Vector{Int}(undef, N))
5454
end
5555

5656
function initialise(
@@ -78,7 +78,8 @@ function predict(
7878
new_particles = map(
7979
x -> SSMProblems.simulate(rng, model.dyn, step, x; kwargs...), collect(filtered)
8080
)
81-
proposed = ParticleDistribution(new_particles, deepcopy(filtered.log_weights))
81+
# Don't need to deep copy weights as filtered will be overwritten in the update step
82+
proposed = ParticleDistribution(new_particles, filtered.log_weights)
8283

8384
return update_ref!(proposed, ref_state, step)
8485
end

0 commit comments

Comments
 (0)