Skip to content

Commit 522b8ad

Browse files
committed
rename internal helper functions to start with .
1 parent 21fa2b1 commit 522b8ad

File tree

6 files changed

+22
-18
lines changed

6 files changed

+22
-18
lines changed

NAMESPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ S3method(varying_args,model_spec)
108108
S3method(varying_args,recipe)
109109
S3method(varying_args,step)
110110
export("%>%")
111+
export(.check_glmnet_penalty_fit)
112+
export(.check_glmnet_penalty_predict)
111113
export(.cols)
112114
export(.dat)
113115
export(.facts)
@@ -123,8 +125,6 @@ export(augment)
123125
export(boost_tree)
124126
export(check_empty_ellipse)
125127
export(check_final_param)
126-
export(check_glmnet_penalty_fit)
127-
export(check_glmnet_penalty_predict)
128128
export(contr_one_hot)
129129
export(control_parsnip)
130130
export(convert_stan_interval)

R/linear_reg.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ translate.linear_reg <- function(x, engine = x$engine, ...) {
107107
x <- translate.default(x, engine, ...)
108108

109109
if (engine == "glmnet") {
110-
check_glmnet_penalty_fit(x)
110+
.check_glmnet_penalty_fit(x)
111111
if (any(names(x$eng_args) == "path_values")) {
112112
# Since we decouple the parsnip `penalty` argument from being the same
113113
# as the glmnet `lambda` value, `path_values` allows users to set the
@@ -255,7 +255,7 @@ predict._elnet <-
255255
penalty <- object$spec$args$penalty
256256
}
257257

258-
object$spec$args$penalty <- check_glmnet_penalty_predict(penalty, object, multi)
258+
object$spec$args$penalty <- .check_glmnet_penalty_predict(penalty, object, multi)
259259

260260
object$spec <- eval_args(object$spec)
261261
predict.model_fit(object, new_data = new_data, type = type, opts = opts, ...)

R/logistic_reg.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ translate.logistic_reg <- function(x, engine = x$engine, ...) {
109109
arg_names <- names(arg_vals)
110110

111111
if (engine == "glmnet") {
112-
check_glmnet_penalty_fit(x)
112+
.check_glmnet_penalty_fit(x)
113113
if (any(names(x$eng_args) == "path_values")) {
114114
# Since we decouple the parsnip `penalty` argument from being the same
115115
# as the glmnet `lambda` value, `path_values` allows users to set the
@@ -296,7 +296,7 @@ predict._lognet <- function(object, new_data, type = NULL, opts = list(), penalt
296296
penalty <- object$spec$args$penalty
297297
}
298298

299-
object$spec$args$penalty <- check_glmnet_penalty_predict(penalty, object, multi)
299+
object$spec$args$penalty <- .check_glmnet_penalty_predict(penalty, object, multi)
300300

301301
object$spec <- eval_args(object$spec)
302302
predict.model_fit(object, new_data = new_data, type = type, opts = opts, ...)

R/misc.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,18 +329,20 @@ stan_conf_int <- function(object, newdata) {
329329
#' Helper functions for checking the penalty of glmnet models
330330
#'
331331
#' @description
332-
#' `check_glmnet_penalty_fit()` checks that the model specification for fitting a
332+
#' These functions are for developer use.
333+
#'
334+
#' `.check_glmnet_penalty_fit()` checks that the model specification for fitting a
333335
#' glmnet model contains a single value.
334336
#'
335-
#' `check_glmnet_penalty_predict()` checks that the penalty value used for prediction is valid.
337+
#' `.check_glmnet_penalty_predict()` checks that the penalty value used for prediction is valid.
336338
#' If called by `predict()`, it needs to be a single value. Multiple values are
337339
#' allowed for `multi_predict()`.
338340
#'
339341
#' @param x An object of class `model_spec`.
340342
#' @rdname glmnet_helpers
341343
#' @keywords internal
342344
#' @export
343-
check_glmnet_penalty_fit <- function(x) {
345+
.check_glmnet_penalty_fit <- function(x) {
344346
pen <- rlang::eval_tidy(x$args$penalty)
345347

346348
if (length(pen) != 1) {
@@ -360,7 +362,7 @@ check_glmnet_penalty_fit <- function(x) {
360362
#' @rdname glmnet_helpers
361363
#' @keywords internal
362364
#' @export
363-
check_glmnet_penalty_predict <- function(penalty = NULL, object, multi = FALSE) {
365+
.check_glmnet_penalty_predict <- function(penalty = NULL, object, multi = FALSE) {
364366

365367
if (is.null(penalty)) {
366368
penalty <- object$fit$lambda

R/multinom_reg.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ predict._multnet <-
222222
penalty <- object$spec$args$penalty
223223
}
224224

225-
object$spec$args$penalty <- check_glmnet_penalty_predict(penalty, object, multi)
225+
object$spec$args$penalty <- .check_glmnet_penalty_predict(penalty, object, multi)
226226

227227
object$spec <- eval_args(object$spec)
228228
res <- predict.model_fit(

man/glmnet_helpers.Rd

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)