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

sse_within_total() ignores dist_fun if data is present in model #184

Open
EmilHvitfeldt opened this issue May 27, 2024 · 0 comments
Open
Labels
bug an unexpected problem or unintended behavior

Comments

@EmilHvitfeldt
Copy link
Member

Here it is taken from https://stackoverflow.com/questions/78540316/r-tidyclust-tune-a-k-prototypes-model/78540444#78540444, which hides the improper use of `cluster::daisy()~

library(tidyclust)
library(tidyverse)
library(tidymodels)

data("penguins", package = "modeldata")

penguins <- penguins %>%
  drop_na()

penguins_cv <- vfold_cv(penguins, v = 5)

# spec1 is for a non-tunable model
kmeans_spec1 <- k_means(engine = 'clustMixType', num_clusters = 4)

penguins_rec <- recipe(~ .,
  data = penguins
)

kmeans_wflow1 <- workflow(penguins_rec, kmeans_spec1)

# non tunable clustering fit
kmeans_fit <- fit(kmeans_wflow1, data = penguins)

# this works without errors
sse_within_total(kmeans_fit)

# this also works
sse_within_total(kmeans_fit, dist_fun = cluster::daisy)
@EmilHvitfeldt EmilHvitfeldt added the bug an unexpected problem or unintended behavior label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant