Skip to content
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

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

Merged
merged 1 commit into from
Mar 10, 2023
Merged

Conversation

simonpcouch
Copy link
Contributor

@simonpcouch simonpcouch commented Mar 9, 2023

Closes #264. :) Same story as in #913.

library(parsnip)

mtcars$am <- as.factor(mtcars$am)
mtcars$cyl <- as.factor(mtcars$cyl)

nearest_neighbor() %>%  
  set_mode("classification") %>%
  set_engine("kknn") %>%
  fit(am ~ ., data = mtcars)
#> parsnip model object
#> 
#> 
#> Call:
#> kknn::train.kknn(formula = am ~ ., data = data, ks = min_rows(5,     data, 5))
#> 
#> Type of response variable: nominal
#> Minimal misclassification: 0.09375
#> Best kernel: optimal
#> Best k: 5

Created on 2023-03-09 with reprex v2.0.2

Copy link
Member

@EmilHvitfeldt EmilHvitfeldt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

@simonpcouch simonpcouch merged commit bb3331c into main Mar 10, 2023
@simonpcouch simonpcouch deleted the kknn-264 branch March 10, 2023 01:07
@github-actions
Copy link

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nearest_neighbor() error with factor predictors & kknn not loaded
2 participants