Skip to content

Commit

Permalink
Added deprecation to old model
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinErickson committed Feb 16, 2024
1 parent e0d9b01 commit 8394bce
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 32 deletions.
33 changes: 8 additions & 25 deletions R/GauPro_Gauss.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
# correlation function should implement:
# corr: name of correlation
# corr_func
# update_params
# get_optim_functions: return optim.func, optim.grad, optim.fngr
# param_optim_lower - lower bound of params
# param_optim_upper - upper
# param_optim_start - current param values
# param_optim_start0 - some central param values that can be used for optimization restarts
# param_optim_jitter - how to jitter params in optimization

# Suggested
# deviance
# deviance_grad
# deviance_fngr
# grad



#' Corr Gauss GP using inherited optim
#'
#' @docType class
Expand Down Expand Up @@ -75,12 +56,14 @@ GauPro_Gauss <- R6::R6Class(
theta = NULL, theta_short = NULL, theta_map = NULL,
...) {
# This doesn't work inside R6 init as of now.
# # Deprecating, haven't used in years. Use kernel model instead.
# lifecycle::deprecate_soft(
# when = "0.2.7",
# what = "GauPro_Gauss$new()",
# details = paste0("Please use GauPro::GauPro_kernel_model instead")
# )
# Deprecating, haven't used in years. Use kernel model instead.
# Can't use deprecate_soft:
# https://github.com/r-lib/lifecycle/issues/149#issuecomment-1790953600
lifecycle::deprecate_warn(
when = "0.2.12",
what = "GauPro_Gauss$new()",
details = paste0("Please use GauPro::GauPro_kernel_model instead")
)

super$initialize(X=X,Z=Z,verbose=verbose,useC=useC,useGrad=useGrad,
parallel=parallel,
Expand Down
8 changes: 1 addition & 7 deletions scratch/ToDo.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@

* Knowledge gradient: multiple starts for optim

* When giving in formula/data
* add to doc
* message what chosen kernel is

* Large Z variance is bad. Extend range of s2. Warning to rescale. Tell kernel
that initial optim values should be large.

* Plot2D:
add axis names, either X1/X2 or colnames
add axis names, either X1/X2 or colnames (need to add option to CF::gcf_grid)
fix for factors

* Add deprecated for old model: lifecycle::

* Check kernel start par outside of bounds set by user. Test if it gives all errors.

* Make gpkm doc look good. Look into R7.
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test_1D.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
test_that("GauPro_Gauss will give deprecation warning on first time", {
n <- 12
x <- matrix(seq(0,1,length.out = n), ncol=1)
y <- sin(2*pi*x) + rnorm(n,0,1e-1)
expect_no_error({expect_warning({gp <- GauPro_Gauss$new(X=x, Z=y, parallel=FALSE)})})
})

test_that("1D data works", {

n <- 12
Expand Down

0 comments on commit 8394bce

Please sign in to comment.