From 047427aa78c3e22257100ac20bf0fe9633e71286 Mon Sep 17 00:00:00 2001 From: unknown <isabelle.sanchez@inra.fr> Date: Fri, 7 Oct 2022 09:11:29 +0200 Subject: [PATCH] reduce examples exec time - CRAN suggestion --- R/kfino.R | 28 ---------------------------- R/utils_functions.R | 10 +++++++--- man/kfino_fit.Rd | 28 ---------------------------- man/utils_EM.Rd | 3 ++- man/utils_fit.Rd | 3 ++- man/utils_likelihood.Rd | 4 +++- 6 files changed, 14 insertions(+), 62 deletions(-) diff --git a/R/kfino.R b/R/kfino.R index 0a20f77..5bed5dc 100644 --- a/R/kfino.R +++ b/R/kfino.R @@ -102,14 +102,6 @@ #' verbose=TRUE) #' Sys.time() - t0 #' -#' # --- With Optimization on initial parameters - EM method -#' t0 <- Sys.time() -#' resu1b<-kfino_fit(datain=spring1, -#' Tvar="dateNum",Yvar="Poids", -#' doOptim=TRUE,method="EM",param=param1, -#' verbose=TRUE) -#' Sys.time() - t0 -#' #' # --- Without Optimization on initial parameters #' t0 <- Sys.time() #' param2<-list(m0=41, @@ -129,26 +121,6 @@ #' doOptim=FALSE, #' verbose=FALSE) #' Sys.time() - t0 -#' -#' # complex data on merinos2 dataset -#' data(merinos2) -#' -#' t0 <- Sys.time() -#' param3<-list(m0=NULL, -#' mm=NULL, -#' pp=NULL, -#' aa=0.001, -#' expertMin=10, -#' expertMax=45, -#' sigma2_m0=1, -#' sigma2_mm=0.05, -#' sigma2_pp=5, -#' K=2, -#' seqp=seq(0.5,0.7,0.1)) -#' resu3<-kfino_fit(datain=merinos2, -#' Tvar="dateNum",Yvar="Poids", -#' doOptim=TRUE,method="ML",param=param3) -#' Sys.time() - t0 kfino_fit<-function(datain,Tvar,Yvar, param=NULL, doOptim=TRUE,method="ML", diff --git a/R/utils_functions.R b/R/utils_functions.R index 465eb6f..2161bfb 100644 --- a/R/utils_functions.R +++ b/R/utils_functions.R @@ -52,7 +52,8 @@ doutlier<-function(y, #' Tvar can be expressed as a proportion of day in seconds #' @param N numeric, length of the numeric vector of Y values #' -#' @details uses the same input parameter list than the main function +#' @details utils_fit is a tool function used in the main \code{kfino_fit} +#' function. It uses the same input parameter list than the main function. #' @return a list #' \describe{ #' \item{prediction}{vector, the prediction of weights} @@ -250,7 +251,9 @@ utils_fit<-function(param,threshold,kappa=10,Y,Tps,N){ #' @param scalingC numeric, scaling constant. To be changed if the function is #' not able to calculate the likelihood because the number of data is large #' -#' @details uses the same input parameter list than the main function +#' @details utils_likelihood is a tool function used in the main +#' \code{kfino_fit} function. It uses the same input parameter list than +#' the main function. #' @return a likelihood #' @keywords internal #' @export @@ -401,7 +404,8 @@ utils_likelihood<-function(param,kappaOpt=7,Y,Tps,N,scalingC){ #' @param scalingC numeric, scaling constant. To be changed if the function is #' not able to calculate the likelihood because the number of data is large #' -#' @details uses the same input parameter list than the main function +#' @details utils_EM is a tool function used in the main \code{kfino_fit} +#' function. It uses the same input parameter list than the main function. #' @return a list: #' \describe{ #' \item{m0}{numeric, optimized m0} diff --git a/man/kfino_fit.Rd b/man/kfino_fit.Rd index b0bc99d..1f31a83 100644 --- a/man/kfino_fit.Rd +++ b/man/kfino_fit.Rd @@ -132,14 +132,6 @@ resu1<-kfino_fit(datain=spring1, verbose=TRUE) Sys.time() - t0 -# --- With Optimization on initial parameters - EM method -t0 <- Sys.time() -resu1b<-kfino_fit(datain=spring1, - Tvar="dateNum",Yvar="Poids", - doOptim=TRUE,method="EM",param=param1, - verbose=TRUE) -Sys.time() - t0 - # --- Without Optimization on initial parameters t0 <- Sys.time() param2<-list(m0=41, @@ -159,24 +151,4 @@ resu2<-kfino_fit(datain=spring1, doOptim=FALSE, verbose=FALSE) Sys.time() - t0 - -# complex data on merinos2 dataset -data(merinos2) - -t0 <- Sys.time() -param3<-list(m0=NULL, - mm=NULL, - pp=NULL, - aa=0.001, - expertMin=10, - expertMax=45, - sigma2_m0=1, - sigma2_mm=0.05, - sigma2_pp=5, - K=2, - seqp=seq(0.5,0.7,0.1)) -resu3<-kfino_fit(datain=merinos2, - Tvar="dateNum",Yvar="Poids", - doOptim=TRUE,method="ML",param=param3) -Sys.time() - t0 } diff --git a/man/utils_EM.Rd b/man/utils_EM.Rd index 7c19d22..e163b7b 100644 --- a/man/utils_EM.Rd +++ b/man/utils_EM.Rd @@ -39,7 +39,8 @@ utils_EM a function to estimate the parameters `m_0` , `mm`, `pp` through an Expectation-Maximization (EM) method } \details{ -uses the same input parameter list than the main function +utils_EM is a tool function used in the main \code{kfino_fit} +function. It uses the same input parameter list than the main function. } \examples{ set.seed(1234) diff --git a/man/utils_fit.Rd b/man/utils_fit.Rd index 4372b67..96acdcb 100644 --- a/man/utils_fit.Rd +++ b/man/utils_fit.Rd @@ -40,7 +40,8 @@ utils_fit a fonction running the kfino algorithm to filter data and detect outliers under the knowledge of all parameters } \details{ -uses the same input parameter list than the main function +utils_fit is a tool function used in the main \code{kfino_fit} +function. It uses the same input parameter list than the main function. } \examples{ set.seed(1234) diff --git a/man/utils_likelihood.Rd b/man/utils_likelihood.Rd index 05bf42e..5961569 100644 --- a/man/utils_likelihood.Rd +++ b/man/utils_likelihood.Rd @@ -33,7 +33,9 @@ utils_likelihood a function to calculate a likelihood on initial parameters optimized by a grid search } \details{ -uses the same input parameter list than the main function +utils_likelihood is a tool function used in the main +\code{kfino_fit} function. It uses the same input parameter list than +the main function. } \examples{ set.seed(1234) -- GitLab