Skip to content

load_libs() with engine == "kknn" and factor predictors #914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* 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).

* Fixed bug where model fits with factor predictors and `engine = "kknn"` would fail when the package's namespace hadn't been attached (#264).

* `.organize_glmnet_pred()` now expects predictions for a single penalty value (#876).

* Fixed bug with prediction from a boosted tree model fitted with `"xgboost"` using a custom objective function (#875).
Expand Down
1 change: 1 addition & 0 deletions R/nearest_neighbor.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ translate.nearest_neighbor <- function(x, engine = x$engine, ...) {
arg_vals <- x$method$fit$args

if (engine == "kknn") {
load_libs(x, quiet = TRUE, attach = TRUE)

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