From 8394bce6d52d757dfd477d6e3d1cd05c7e0ad7bf Mon Sep 17 00:00:00 2001 From: Collin Erickson Date: Thu, 15 Feb 2024 23:38:05 -0500 Subject: [PATCH] Added deprecation to old model --- R/GauPro_Gauss.R | 33 ++++++++------------------------- scratch/ToDo.md | 8 +------- tests/testthat/test_1D.R | 7 +++++++ 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/R/GauPro_Gauss.R b/R/GauPro_Gauss.R index fa4383d..046ffb3 100644 --- a/R/GauPro_Gauss.R +++ b/R/GauPro_Gauss.R @@ -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 @@ -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, diff --git a/scratch/ToDo.md b/scratch/ToDo.md index 06c6065..fd15060 100644 --- a/scratch/ToDo.md +++ b/scratch/ToDo.md @@ -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. diff --git a/tests/testthat/test_1D.R b/tests/testthat/test_1D.R index d0d7fa0..f3a4240 100644 --- a/tests/testthat/test_1D.R +++ b/tests/testthat/test_1D.R @@ -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