From 9b93bf3c512252b0050db39133858512a796b516 Mon Sep 17 00:00:00 2001 From: "C. Regouby" Date: Fri, 14 Jun 2024 20:17:36 +0200 Subject: [PATCH] fix check() warning and notes --- DESCRIPTION | 2 +- R/parsnip.R | 7 ++----- R/plot.R | 4 ++-- man/tabnet.Rd | 9 ++++++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ed921305..685f68ea 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,7 +42,6 @@ Imports: tune, utils, vctrs, - vip, withr, zeallot Suggests: @@ -55,6 +54,7 @@ Suggests: testthat (>= 3.0.0), tidymodels, tidyverse, + vip, visdat, workflows, yardstick diff --git a/R/parsnip.R b/R/parsnip.R index 98bfb728..f2052896 100644 --- a/R/parsnip.R +++ b/R/parsnip.R @@ -426,6 +426,7 @@ add_parsnip_tabnet <- function() { #' @param mode A single character string for the type of model. Possible values #' for this model are "unknown", "regression", or "classification". #' @inheritParams tabnet_config +#' @inheritParams tabnet_fit #' #' @inheritSection tabnet_fit Threading #' @seealso tabnet_fit @@ -444,8 +445,7 @@ add_parsnip_tabnet <- function() { #' #' @export tabnet <- function(mode = "unknown", cat_emb_dim = NULL, decision_width = NULL, attention_width = NULL, - num_steps = NULL, mask_type = NULL, mlp_hidden_multiplier = NULL, mlp_activation = NULL, - encoder_activation = NULL, num_independent = NULL, num_shared = NULL, + num_steps = NULL, mask_type = NULL, num_independent = NULL, num_shared = NULL, num_independent_decoder = NULL, num_shared_decoder = NULL, penalty = NULL, feature_reusage = NULL, momentum = NULL, epochs = NULL, batch_size = NULL, virtual_batch_size = NULL, learn_rate = NULL, optimizer = NULL, loss = NULL, @@ -471,9 +471,6 @@ tabnet <- function(mode = "unknown", cat_emb_dim = NULL, decision_width = NULL, attention_width = rlang::enquo(attention_width), num_steps = rlang::enquo(num_steps), mask_type = rlang::enquo(mask_type), - mlp_hidden_multiplier = rlang::enquo(mlp_hidden_multiplier), - mlp_activation = rlang::enquo(mlp_activation), - encoder_activation = rlang::enquo(encoder_activation), num_independent = rlang::enquo(num_independent), num_shared = rlang::enquo(num_shared), num_independent_decoder = rlang::enquo(num_independent_decoder), diff --git a/R/plot.R b/R/plot.R index d05fec45..c1b681cd 100644 --- a/R/plot.R +++ b/R/plot.R @@ -40,8 +40,8 @@ autoplot.tabnet_fit <- function(object, ...) { if ("checkpoint" %in% names(collect_metrics)) { checkpoints <- collect_metrics %>% - dplyr::filter(checkpoint == TRUE, dataset == "train") %>% - dplyr::select(-checkpoint) %>% + dplyr::filter(.data$checkpoint == TRUE, dataset == "train") %>% + dplyr::select(-.data$checkpoint) %>% dplyr::mutate(size = 2) p + ggplot2::geom_point(data = checkpoints, ggplot2::aes(x = epoch, y = loss, color = dataset, size = .data$size )) diff --git a/man/tabnet.Rd b/man/tabnet.Rd index 5b19c9c4..d4684b10 100644 --- a/man/tabnet.Rd +++ b/man/tabnet.Rd @@ -11,9 +11,6 @@ tabnet( attention_width = NULL, num_steps = NULL, mask_type = NULL, - mlp_hidden_multiplier = NULL, - mlp_activation = NULL, - encoder_activation = NULL, num_independent = NULL, num_shared = NULL, num_independent_decoder = NULL, @@ -142,6 +139,12 @@ display a warning.} \item{early_stopping_patience}{Number of epochs without improving until stopping training. (default=5)} \item{skip_importance}{if feature importance calculation should be skipped (default: \code{FALSE})} + +\item{tabnet_model}{A previously fitted TabNet model object to continue the fitting on. +if \code{NULL} (the default) a brand new model is initialized.} + +\item{from_epoch}{When a \code{tabnet_model} is provided, restore the network weights from a specific epoch. +Default is last available checkpoint for restored model, or last epoch for in-memory model.} } \value{ A TabNet \code{parsnip} instance. It can be used to fit tabnet models using