Skip to content

Commit

Permalink
fix R CMD check
Browse files Browse the repository at this point in the history
  • Loading branch information
cregouby committed Jul 27, 2024
1 parent 9732d02 commit 5a9cb18
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ BugReports: https://github.com/mlverse/tabnet/issues
Depends:
R (>= 3.6)
Imports:
cli,
coro,
data.tree,
dials,
Expand All @@ -46,6 +45,7 @@ Imports:
withr,
zeallot
Suggests:
cli,
knitr,
modeldata,
patchwork,
Expand Down
37 changes: 23 additions & 14 deletions R/dials.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ check_dials <- function() {
stop("Package \"dials\" needed for this function to work. Please install it.", call. = FALSE)
}

check_cli <- function() {
if (!requireNamespace("cli", quietly = TRUE))
stop("Package \"cli\" needed for this function to work. Please install it.", call. = FALSE)
}



#' Parameters for the tabnet model
Expand Down Expand Up @@ -127,57 +132,61 @@ num_steps <- function(range = c(3L, 10L), trans = NULL) {
)
}

#' @noRd
#' Non-tunable parameters for the tabnet model
#'
#' @param range unused
#' @param trans unused
#' @rdname tabnet_non_tunable
#' @export
cat_emb_dim <- function(range = NULL, trans = NULL) {
check_dials()
check_cli()
cli::cli_abort("{.var cat_emb_dim} cannot be used as a {.fun tune} parameter yet.")
}

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
checkpoint_epochs <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
drop_last <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
encoder_activation <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
lr_scheduler <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
mlp_activation <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
mlp_hidden_multiplier <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
num_independent_decoder <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
num_shared_decoder <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
optimizer <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
penalty <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
verbose <- cat_emb_dim

#' @noRd
#' @rdname tabnet_non_tunable
#' @export
virtual_batch_size <- cat_emb_dim
5 changes: 5 additions & 0 deletions R/parsnip.R
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,11 @@ add_parsnip_tabnet <- function() {
#' for this model are "unknown", "regression", or "classification".
#' @inheritParams tabnet_config
#' @inheritParams tabnet_fit
#' @param rate_decay multiplies the initial learning rate by `rate_decay` every
#' `rate_step_size` epochs. Unused if `lr_scheduler` is a `torch::lr_scheduler`
#' or `NULL`.
#' @param rate_step_size the learning rate scheduler step size. Unused if
#' `lr_scheduler` is a `torch::lr_scheduler` or `NULL`.
#'
#' @inheritSection tabnet_fit Threading
#' @seealso tabnet_fit
Expand Down
3 changes: 2 additions & 1 deletion inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Pretrain
Sercan
TabNet
TabNet's
adam
ai
al
ames
Expand All @@ -37,6 +36,7 @@ ggplot
interpretable
mse
nn
num
orginal
overfit
overfits
Expand All @@ -49,4 +49,5 @@ sparsemax
subprocesses
th
tidymodels
tunable
zeallot
7 changes: 7 additions & 0 deletions man/tabnet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions man/tabnet_non_tunable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5a9cb18

Please sign in to comment.