Skip to content

Fix default degree of PiecewisePolynomialKernel #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 16, 2021
Merged
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "KernelFunctions"
uuid = "ec8451be-7e33-11e9-00cf-bbf324bd1392"
version = "0.8.14"
version = "0.8.15"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Expand Down
3 changes: 2 additions & 1 deletion src/basekernels/piecewisepolynomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ struct PiecewisePolynomialKernel{D,C<:Tuple} <: SimpleKernel
end

# TODO: remove `maha` keyword argument in next breaking release
function PiecewisePolynomialKernel(; v::Int=-1, degree::Int=v, maha=nothing, dim::Int=-1)
function PiecewisePolynomialKernel(; v::Int=-1, degree::Int=0, maha=nothing, dim::Int=-1)
if v != -1
Base.depwarn(
"keyword argument `v` is deprecated, use `degree` instead",
:PiecewisePolynomialKernel,
)
degree = v
end

if maha !== nothing
Expand Down
5 changes: 5 additions & 0 deletions test/basekernels/piecewisepolynomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
@test_throws ErrorException PiecewisePolynomialKernel{4}(maha)
@test_throws ErrorException PiecewisePolynomialKernel{4}(D)
@test_throws ErrorException PiecewisePolynomialKernel{degree}(-1)
@test_throws ErrorException PiecewisePolynomialKernel()
@test_throws ErrorException PiecewisePolynomialKernel(; degree=degree)

# default degree
@test PiecewisePolynomialKernel(; dim=D) isa PiecewisePolynomialKernel{0}

@test repr(k) ==
"Piecewise Polynomial Kernel (degree = $(degree), ⌊dim/2⌋ = $(div(D, 2)))"
Expand Down