Skip to content

Commit 5155a01

Browse files
authored
Rename from VecchiaMLE.jl to NonparametricVecchia.jl (#135)
1 parent dab461b commit 5155a01

17 files changed

+107
-102
lines changed

.github/workflows/Aqua.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
version: 'lts'
1616
- name: Aqua.jl
1717
run: julia --color=yes -e 'using Pkg; Pkg.add("Aqua"); Pkg.develop(path=".");
18-
using Aqua, VecchiaMLE; Aqua.test_all(VecchiaMLE)'
18+
using Aqua, NonparametricVecchia; Aqua.test_all(NonparametricVecchia)'

.github/workflows/moonshot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ jobs:
3636
Pkg.activate(".")
3737
path_HSL_jll = "/scratch/github-actions/actions_runner_hsl/HSL_jll.jl.v" * ENV["HSL_VERSION"]
3838
Pkg.develop(path=path_HSL_jll)
39-
- name: Test VecchiaMLE.jl
39+
- name: Test NonparametricVecchia.jl
4040
shell: julia --color=yes {0}
4141
run: |
4242
using Pkg
4343
Pkg.develop(path=".")
44-
Pkg.test("VecchiaMLE")
44+
Pkg.test("NonparametricVecchia")
4545
- uses: julia-actions/julia-processcoverage@v1
4646
- uses: codecov/codecov-action@v5
4747
with:

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name = "VecchiaMLE"
1+
name = "NonparametricVecchia"
22
uuid = "499233a1-c46f-47cc-ab67-5a37788e9870"
33
version = "0.1.0"
44
authors = ["Caleb Derrickson (@CalebDerrickson), Alexis Montoison (@amontoison)", "Chris Geoga (@cgeoga)"]
@@ -15,8 +15,8 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1515
Vecchia = "8d73829f-f4b0-474a-9580-cecc8e084068"
1616

1717
[extensions]
18-
VecchiaMLECUDAExt = ["CUDA", "KernelAbstractions"]
19-
VecchiaMLEVecchiaExt = ["StaticArrays", "Vecchia"]
18+
NonparametricVecchiaCUDAExt = ["CUDA", "KernelAbstractions"]
19+
NonparametricVecchiaVecchiaExt = ["StaticArrays", "Vecchia"]
2020

2121
[compat]
2222
CUDA = "5.8.2"

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
# VecchiaMLE
1+
# NonparametricVecchia
22

33
[![docs-dev][docs-dev-img]][docs-dev-url] [![ci][ci-img]][ci-url]
44

55
[docs-dev-img]: https://img.shields.io/badge/docs-dev-purple.svg
6-
[docs-dev-url]: https://exanauts.github.io/VecchiaMLE.jl/dev
7-
[ci-img]: https://github.com/exanauts/VecchiaMLE.jl/actions/workflows/CI.yml/badge.svg
8-
[ci-url]: https://github.com/exanauts/VecchiaMLE.jl/actions/workflows/CI.yml
6+
[docs-dev-url]: https://exanauts.github.io/NonparametricVecchia.jl/dev
7+
[ci-img]: https://github.com/exanauts/NonparametricVecchia.jl/actions/workflows/CI.yml/badge.svg
8+
[ci-url]: https://github.com/exanauts/NonparametricVecchia.jl/actions/workflows/CI.yml
99

1010
## Overview
1111

12-
**VecchiaMLE.jl** is a Julia package that approximates the inverse cholesky factor of a Gaussian process covariance matrix via a nonparametric optimization process.
13-
The nonzero entries of the inverse cholesky, `L`, are determined via the Vecchia Approximation.
14-
The values of `L` are recovered via optimizing the joint probability distribution function (mean zero) to best match the given samples.
12+
**NonparametricVecchia.jl** is a Julia package that approximates the inverse
13+
cholesky factor of a Gaussian process covariance matrix via a nonparametric
14+
optimization process. The nonzero entries of the inverse cholesky, `L`, are
15+
determined via the Vecchia Approximation. The values of `L` are recovered via
16+
optimizing the joint probability distribution function (mean zero) to best match
17+
the given samples.
1518

1619
## Installation
1720

18-
This package is not registered but can be installed and tested through the Julia package manager:
21+
This package is not registered but can be installed and tested through the Julia
22+
package manager:
1923

2024
```julia
2125
julia> ]
22-
pkg> add https://github.com/exanauts/VecchiaMLE.jl.git
23-
pkg> test VecchiaMLE
26+
pkg> add https://github.com/exanauts/NonparametricVecchia.jl.git
27+
pkg> test NonparametricVecchia
2428
```

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
MadNLP = "2621e9c9-9eb4-46b1-8089-e8c72242dfb6"
44
NLPModelsIpopt = "f4238b75-b362-5c4c-b852-0801c9a21d71"
55
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
6-
VecchiaMLE = "499233a1-c46f-47cc-ab67-5a37788e9870"
6+
NonparametricVecchia = "499233a1-c46f-47cc-ab67-5a37788e9870"
77
Vecchia = "8d73829f-f4b0-474a-9580-cecc8e084068"
88

99
[compat]

docs/make.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
using Documenter, VecchiaMLE
1+
using Documenter, NonparametricVecchia
22

33
makedocs(
4-
modules = [VecchiaMLE],
4+
modules = [NonparametricVecchia],
55
doctest = true,
66
linkcheck = true,
77
format = Documenter.HTML(ansicolor = true,
88
prettyurls = get(ENV, "CI", nothing) == "true",
99
collapselevel = 1),
10-
sitename = "VecchiaMLE.jl",
10+
sitename = "NonparametricVecchia.jl",
1111
pages = ["Home" => "index.md"], # "Tutorials" => "vecchia_model.md"
1212
)
1313

1414
deploydocs(
15-
repo = "github.com/exanauts/VecchiaMLE.jl.git",
15+
repo = "github.com/exanauts/NonparametricVecchia.jl.git",
1616
push_preview = true,
17-
devbranch = "master",
17+
devbranch = "main",
1818
)

docs/src/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [VecchiaMLE.jl documentation](@id Home)
1+
# [NonparametricVecchia.jl documentation](@id Home)
22

33
## Overview
44

@@ -9,6 +9,6 @@ The Cholesky factor is computed via the Vecchia approximation, which is sparse a
99

1010
```julia
1111
julia> ]
12-
pkg> add https://github.com/exanauts/VecchiaMLE.jl.git
13-
pkg> test VecchiaMLE
12+
pkg> add https://github.com/exanauts/NonparametricVecchia.jl.git
13+
pkg> test NonparametricVecchia
1414
```

docs/src/vecchia_model.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
```@example VecchiaModel_L
2-
using VecchiaMLE
2+
using NonparametricVecchia
33
using LinearAlgebra
44
using SparseArrays
55
using NLPModelsIpopt
@@ -18,7 +18,7 @@ L = recover_factor(nlp_L, output.solution)
1818
```
1919

2020
```@example VecchiaModel_U
21-
using VecchiaMLE
21+
using NonparametricVecchia
2222
using LinearAlgebra
2323
using SparseArrays
2424
using NLPModelsIpopt
@@ -37,7 +37,7 @@ U = recover_factor(nlp_U, output.solution)
3737
```
3838

3939
```@example Vecchia
40-
using VecchiaMLE
40+
using NonparametricVecchia
4141
using Vecchia
4242
using StaticArrays
4343
using LinearAlgebra
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
module VecchiaMLECUDAExt
1+
module NonparametricVecchiaCUDAExt
22

33
using LinearAlgebra
44
using NLPModels
5-
using VecchiaMLE
5+
using NonparametricVecchia
66
using CUDA
77
using CUDA.CUSPARSE
88
using KernelAbstractions
99

10-
function VecchiaMLE.VecchiaModel(I::Vector{Int}, J::Vector{Int}, samples::CuMatrix{T};
11-
lvar_diag::Union{Nothing,CuVector{T}}=nothing, uvar_diag::Union{Nothing,CuVector{T}}=nothing,
12-
lambda::Real=0, format::Symbol=:coo, uplo::Symbol=:L) where T
10+
function NonparametricVecchia.VecchiaModel(I::Vector{Int}, J::Vector{Int}, samples::CuMatrix{T};
11+
lvar_diag::Union{Nothing,CuVector{T}}=nothing,
12+
uvar_diag::Union{Nothing,CuVector{T}}=nothing,
13+
lambda::Real=0, format::Symbol=:coo, uplo::Symbol=:L) where T
1314
S = CuArray{T, 1, CUDA.DeviceMemory}
14-
cache = VecchiaMLE.create_vecchia_cache(I, J, samples, T(lambda), format, uplo)
15+
cache = NonparametricVecchia.create_vecchia_cache(I, J, samples, T(lambda), format, uplo)
1516

1617
nvar = length(cache.rowsL) + length(cache.colptrL) - 1
1718
ncon = length(cache.colptrL) - 1
@@ -60,8 +61,8 @@ function VecchiaMLE.VecchiaModel(I::Vector{Int}, J::Vector{Int}, samples::CuMatr
6061
end
6162

6263

63-
function VecchiaMLE.create_vecchia_cache(I::Vector{Int}, J::Vector{Int}, samples::CuMatrix{T},
64-
lambda::T, format::Symbol, uplo::Symbol) where {T}
64+
function NonparametricVecchia.create_vecchia_cache(I::Vector{Int}, J::Vector{Int}, samples::CuMatrix{T},
65+
lambda::T, format::Symbol, uplo::Symbol) where {T}
6566
S = CuArray{T, 1, CUDA.DeviceMemory}
6667
Msamples, n = size(samples)
6768

@@ -95,7 +96,7 @@ function VecchiaMLE.create_vecchia_cache(I::Vector{Int}, J::Vector{Int}, samples
9596
m = CuVector{Int}(m)
9697

9798
hess_obj_vals = S(undef, nnzh_tri_obj)
98-
VecchiaMLE.vecchia_build_B!(B, samples, lambda, rowsL, colptrL, hess_obj_vals, n, m)
99+
NonparametricVecchia.vecchia_build_B!(B, samples, lambda, rowsL, colptrL, hess_obj_vals, n, m)
99100

100101
if uplo == :L
101102
diagL = colptrL[1:n]
@@ -107,7 +108,7 @@ function VecchiaMLE.create_vecchia_cache(I::Vector{Int}, J::Vector{Int}, samples
107108
end
108109
buffer = S(undef, nnzL)
109110

110-
return VecchiaMLE.VecchiaCache{eltype(S), S, typeof(rowsL), typeof(B[1])}(
111+
return NonparametricVecchia.VecchiaCache{eltype(S), S, typeof(rowsL), typeof(B[1])}(
111112
n, Msamples, nnzL,
112113
colptrL, rowsL, diagL,
113114
m, offsets, B, nnzh_tri_obj,
@@ -116,7 +117,7 @@ function VecchiaMLE.create_vecchia_cache(I::Vector{Int}, J::Vector{Int}, samples
116117
)
117118
end
118119

119-
function VecchiaMLE.recover_factor(nlp::VecchiaModel{T,<:CuVector{T}}, solution::CuVector{T}) where T
120+
function NonparametricVecchia.recover_factor(nlp::VecchiaModel{T,<:CuVector{T}}, solution::CuVector{T}) where T
120121
n = nlp.cache.n
121122
colptr = nlp.cache.colptrL
122123
rowval = nlp.cache.rowsL
@@ -126,8 +127,8 @@ function VecchiaMLE.recover_factor(nlp::VecchiaModel{T,<:CuVector{T}}, solution:
126127
return factor
127128
end
128129

129-
function VecchiaMLE.vecchia_mul!(y::CuVector{T}, B::Vector{<:CuMatrix{T}}, hess_obj_vals::CuVector{T},
130-
x::CuVector{T}, n::Int, m::CuVector{Int}, offsets::CuVector{Int}) where T <: AbstractFloat
130+
function NonparametricVecchia.vecchia_mul!(y::CuVector{T}, B::Vector{<:CuMatrix{T}}, hess_obj_vals::CuVector{T},
131+
x::CuVector{T}, n::Int, m::CuVector{Int}, offsets::CuVector{Int}) where T <: AbstractFloat
131132
# Reset the vector y
132133
fill!(y, zero(T))
133134

@@ -139,9 +140,9 @@ function VecchiaMLE.vecchia_mul!(y::CuVector{T}, B::Vector{<:CuMatrix{T}}, hess_
139140
return y
140141
end
141142

142-
function VecchiaMLE.vecchia_build_B!(B::Vector{<:CuMatrix{T}}, samples::CuMatrix{T}, lambda::T,
143-
rowsL::CuVector{Int}, colptrL::CuVector{Int}, hess_obj_vals::CuVector{T},
144-
n::Int, m::CuVector{Int}) where T <: AbstractFloat
143+
function NonparametricVecchia.vecchia_build_B!(B::Vector{<:CuMatrix{T}}, samples::CuMatrix{T}, lambda::T,
144+
rowsL::CuVector{Int}, colptrL::CuVector{Int}, hess_obj_vals::CuVector{T},
145+
n::Int, m::CuVector{Int}) where T <: AbstractFloat
145146
# Launch the kernel
146147
backend = KernelAbstractions.get_backend(samples)
147148
r = size(samples, 1)
@@ -151,8 +152,8 @@ function VecchiaMLE.vecchia_build_B!(B::Vector{<:CuMatrix{T}}, samples::CuMatrix
151152
return nothing
152153
end
153154

154-
function VecchiaMLE.vecchia_generate_hess_tri_structure!(nnzh::Int, n::Int, colptr_diff::CuVector{Int},
155-
hrows::CuVector{Int}, hcols::CuVector{Int})
155+
function NonparametricVecchia.vecchia_generate_hess_tri_structure!(nnzh::Int, n::Int, colptr_diff::CuVector{Int},
156+
hrows::CuVector{Int}, hcols::CuVector{Int})
156157
# reset hrows, hcols
157158
fill!(hrows, one(Int))
158159
fill!(hcols, one(Int))
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module NonparametricVecchiaVecchiaExt
2+
3+
using NonparametricVecchia, Vecchia, StaticArrays
4+
5+
function NonparametricVecchia.VecchiaModel(pts::Vector{SVector{D,Float64}},
6+
data::Matrix{Float64},
7+
ordering, conditioning;
8+
lvar_diag=fill(1e-10, length(pts)),
9+
uvar_diag=fill(1e10, length(pts)),
10+
lambda=0.0) where{D}
11+
va = VecchiaApproximation(pts, nothing, data; ordering=ordering,
12+
conditioning=conditioning)
13+
VecchiaModel(va; lvar_diag=lvar_diag, uvar_diag=uvar_diag, lambda=lambda)
14+
end
15+
16+
function NonparametricVecchia.VecchiaModel(va::VecchiaApproximation;
17+
lvar_diag=fill(1e-10, length(pts)),
18+
uvar_diag=fill(1e10, length(pts)),
19+
lambda=0.0)
20+
(condsets, perm) = (va.condix, va.perm)
21+
n = length(condsets)
22+
nnz = sum(length, condsets) + length(condsets)
23+
IJ = Vector{Tuple{Int64, Int64}}()
24+
sizehint!(IJ, nnz)
25+
for (j, cj) in enumerate(condsets)
26+
foreach(k->push!(IJ, (k, j)), cj)
27+
push!(IJ, (j,j))
28+
end
29+
(I, J) = (getindex.(IJ, 1), getindex.(IJ, 2))
30+
(perm, VecchiaModel(I, J, permutedims(va.data);
31+
uplo=:U, lvar_diag=lvar_diag,
32+
uvar_diag=uvar_diag, lambda=lambda))
33+
end
34+
35+
end

0 commit comments

Comments
 (0)