Skip to content

Commit bb3331c

Browse files
authored
load_libs() with engine == "kknn" and factor predictors (#914)
1 parent f928323 commit bb3331c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
* Made `fit()` behave consistently with respect to missingness in the classification setting. Previously, `fit()` erroneously raised an error about the class of the outcome when there were no complete cases, and now always passes along complete cases to be handled by the modeling function (#888).
66

7+
* Fixed bug where model fits with factor predictors and `engine = "kknn"` would fail when the package's namespace hadn't been attached (#264).
8+
79
* `.organize_glmnet_pred()` now expects predictions for a single penalty value (#876).
810

911
* Fixed bug where model fits with `engine = "earth"` would fail when the package's namespace hadn't been attached (#251).

R/nearest_neighbor.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ translate.nearest_neighbor <- function(x, engine = x$engine, ...) {
120120
arg_vals <- x$method$fit$args
121121

122122
if (engine == "kknn") {
123+
load_libs(x, quiet = TRUE, attach = TRUE)
123124

124125
if (!any(names(arg_vals) == "ks") || is_missing_arg(arg_vals$ks)) {
125126
arg_vals$ks <- 5

0 commit comments

Comments
 (0)