From: Benjamin Auder Date: Wed, 4 Mar 2020 17:14:01 +0000 (+0100) Subject: Rename main function into runValse, remove testthat folder since nobody's gonna write... X-Git-Url: https://git.auder.net/doc/html/css/current/scripts/pieces/R.css?a=commitdiff_plain;h=859c30ec72871f923da0498c14a94e67b0219875;p=valse.git Rename main function into runValse, remove testthat folder since nobody's gonna write tests --- diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index b620b65..8dd0fcb 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -23,8 +23,7 @@ Imports: Suggests: capushe, methods, - roxygen2, - testthat + roxygen2 URL: http://git.auder.net/?p=valse.git License: MIT + file LICENSE RoxygenNote: 7.0.2 diff --git a/pkg/R/initSmallEM.R b/pkg/R/initSmallEM.R index 937ea73..fccd51d 100644 --- a/pkg/R/initSmallEM.R +++ b/pkg/R/initSmallEM.R @@ -5,9 +5,10 @@ #' @param Y matrix of responses (of size n*m) #' #' @return a list with phiInit, rhoInit, piInit, gamInit -#' @export +#' #' @importFrom methods new #' @importFrom stats cutree dist hclust runif +#' @export initSmallEM <- function(k, X, Y, fast) { n <- nrow(X) diff --git a/pkg/R/main.R b/pkg/R/main.R index 8649342..85a41b7 100644 --- a/pkg/R/main.R +++ b/pkg/R/main.R @@ -1,4 +1,4 @@ -#' valse +#' runValse #' #' Main function #' @@ -26,8 +26,9 @@ #' #' @examples #' #TODO: a few examples +#' #' @export -valse <- function(X, Y, procedure = "LassoMLE", selecMod = "DDSE", gamma = 1, mini = 10, +runValse <- function(X, Y, procedure = "LassoMLE", selecMod = "DDSE", gamma = 1, mini = 10, maxi = 50, eps = 1e-04, kmin = 2, kmax = 3, rank.min = 1, rank.max = 5, ncores_outer = 1, ncores_inner = 1, thresh = 1e-08, grid_lambda = numeric(0), size_coll_mod = 10, fast = TRUE, verbose = FALSE, plot = TRUE) diff --git a/pkg/R/plot_valse.R b/pkg/R/plot_valse.R index 83316dc..3160067 100644 --- a/pkg/R/plot_valse.R +++ b/pkg/R/plot_valse.R @@ -8,10 +8,7 @@ #' @param n sample size #' @return several plots #' -#' @examples TODO -#' #' @export -#' plot_valse <- function(X, Y, model, n, comp = FALSE, k1 = NA, k2 = NA) { require("gridExtra") diff --git a/pkg/R/selectVariables.R b/pkg/R/selectVariables.R index a4bc0f4..0c18c67 100644 --- a/pkg/R/selectVariables.R +++ b/pkg/R/selectVariables.R @@ -18,10 +18,7 @@ #' #' @return a list of outputs, for each lambda in grid: selected,Rho,Pi #' -#' @examples TODO -#' #' @export -#' selectVariables <- function(phiInit, rhoInit, piInit, gamInit, mini, maxi, gamma, glambda, X, Y, thresh = 1e-08, eps, ncores = 3, fast) { diff --git a/pkg/inst/testdata/TODO.csv b/pkg/inst/testdata/TODO.csv deleted file mode 100644 index d679966..0000000 --- a/pkg/inst/testdata/TODO.csv +++ /dev/null @@ -1 +0,0 @@ -ou alors data_test.RData, possible aussi diff --git a/pkg/man/valse-package.Rd b/pkg/man/valse-package.Rd index 534375b..377891d 100644 --- a/pkg/man/valse-package.Rd +++ b/pkg/man/valse-package.Rd @@ -12,14 +12,12 @@ } \details{ - The package devtools should be useful in development stage, since we rely on testthat for - unit tests, and roxygen2 for documentation. knitr is used to generate the package vignette. - Concerning the other suggested packages: - \itemize{ - \item{parallel (generally) permits to run the bootstrap method faster.} - } - - The three main functions are ... + Two methods are implemented to cluster data with finite mixture + regression models. Those procedures deal with high-dimensional covariates and + responses through a variable selection procedure based on the Lasso estimator. + + The main function is runValse(), which calls all other functions. + See also plot_valse() which plots the relevant parameters after a run. } \author{ diff --git a/pkg/tests/testthat.R b/pkg/tests/testthat.R deleted file mode 100644 index 88e5631..0000000 --- a/pkg/tests/testthat.R +++ /dev/null @@ -1,4 +0,0 @@ -library(testthat) -library(valse) #ou load_all() - -test_check("valse") diff --git a/pkg/tests/testthat/helper-context1.R b/pkg/tests/testthat/helper-context1.R deleted file mode 100644 index b40f358..0000000 --- a/pkg/tests/testthat/helper-context1.R +++ /dev/null @@ -1,5 +0,0 @@ -# Potential helpers for context 1 -help <- function() -{ - #... -} diff --git a/pkg/tests/testthat/test-context1.R b/pkg/tests/testthat/test-context1.R deleted file mode 100644 index 17c633f..0000000 --- a/pkg/tests/testthat/test-context1.R +++ /dev/null @@ -1,11 +0,0 @@ -context("Context1") - -test_that("function 1...", -{ - #expect_lte( ..., ...) -}) - -test_that("function 2...", -{ - #expect_equal(..., ...) -}) diff --git a/pkg/vignettes/.gitignore b/pkg/vignettes/.gitignore deleted file mode 100644 index e6493d4..0000000 --- a/pkg/vignettes/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -#ignore jupyter generated file (ipynb, HTML) -*.html -*.ipynb - -#and various (pdf)LaTeX files, in case of -*.tex -*.pdf -*.aux -*.dvi -*.log -*.out -*.toc -*.synctex.gz -/figure/ diff --git a/test/script_data.R b/test/script_data.R index da319da..1635746 100644 --- a/test/script_data.R +++ b/test/script_data.R @@ -10,6 +10,6 @@ Beta[1:4,1:4,1] = 3*diag(4) Beta[1:4,1:4,2] = -2*diag(4) Data = generateXY(200, c(0.5,0.5), rep(0,p), Beta, diag(p), covY) -# + Res = valse(Data$X,Data$Y, fast=TRUE, plot=FALSE, verbose = TRUE, kmax=3, size_coll_mod = 50, selecMod = "DDSE", mini = 50, maxi=100) plot(Res$tableau[,3], -Res$tableau[,4])