Skip to content

Commit

Permalink
Deprecate constructor with two kernels (#28)
Browse files Browse the repository at this point in the history
bors r+
  • Loading branch information
devmotion committed Feb 28, 2021
1 parent 1973962 commit b040113
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CalibrationTests"
uuid = "2818745e-0823-50c7-bc2d-405ac343d48b"
authors = ["David Widmann <[email protected]>"]
version = "0.4.2"
version = "0.4.3"

[deps]
CalibrationErrors = "33913031-fe46-5864-950f-100836f47845"
Expand Down
4 changes: 4 additions & 0 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@deprecate AsymptoticSKCETest(kernel1::Kernel, kernel2::Kernel, data...; kwargs...) AsymptoticSKCETest(
kernel1 kernel2, data...; kwargs...
)

@deprecate AsymptoticBlockSKCETest(kernel1::Kernel, kernel2::Kernel, args...) AsymptoticBlockSKCETest(
kernel1 kernel2, args...
)
4 changes: 0 additions & 4 deletions src/skce/asymptotic_block.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ function AsymptoticBlockSKCETest(skce::BlockUnbiasedSKCE, data...)
return AsymptoticBlockSKCETest(skce.kernel, skce.blocksize, data...)
end

function AsymptoticBlockSKCETest(κpredictions::Kernel, κtargets::Kernel, args...)
return AsymptoticBlockSKCETest(TensorProduct(κpredictions, κtargets), args...)
end

function AsymptoticBlockSKCETest(kernel::Kernel, blocksize::Int, data...)
# obtain predictions and targets
predictions, targets = CalibrationErrors.predictions_targets(data...)
Expand Down
21 changes: 18 additions & 3 deletions test/skce/asymptotic_block.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ Random.seed!(1234)
end

@testset "consistency" begin
kernel1 = transform(ExponentialKernel(), 0.1)
kernel2 = WhiteKernel()
kernel = kernel1 kernel2
αs = 0.05:0.1:0.95
nsamples = 100

Expand All @@ -63,9 +66,7 @@ end

for blocksize in (2, 5, 10)
# create block estimator
skce = BlockUnbiasedSKCE(
transform(ExponentialKernel(), 0.1) WhiteKernel(), blocksize
)
skce = BlockUnbiasedSKCE(kernel, blocksize)

for nclasses in (2, 10)
dist = Dirichlet(nclasses, 1)
Expand All @@ -89,6 +90,20 @@ end
# estimate pvalues
pvalues_consistent[i] = pvalue(test_consistent)
pvalues_onlyone[i] = pvalue(test_onlyone)

# deprecations
for (targets, test) in
((targets_consistent, test_consistent), (targets_onlyone, test_onlyone))
test2 = @test_deprecated AsymptoticBlockSKCETest(
kernel1, kernel2, blocksize, predictions, targets
)
@test test2.kernel == test.kernel
@test test2.blocksize == test.blocksize
@test test2.nblocks == test.nblocks
@test test2.estimate == test.estimate
@test test2.stderr == test.stderr
@test test2.z == test.z
end
end

# compute empirical test errors
Expand Down

2 comments on commit b040113

@devmotion
Copy link
Owner Author

Choose a reason for hiding this comment

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

@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/30954

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.4.3 -m "<description of version>" b040113b7e3ffbcdec8cde70d4fc26775e296d68
git push origin v0.4.3

Please sign in to comment.