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

Error message when nstart is misspecified #181

Open
katieburak opened this issue Mar 19, 2024 · 1 comment
Open

Error message when nstart is misspecified #181

katieburak opened this issue Mar 19, 2024 · 1 comment
Labels
bug an unexpected problem or unintended behavior

Comments

@katieburak
Copy link

When performing k-means, if you use the wrong name for nstart (e.g., nstarts) it does not throw you an error. For example, the following code chunk runs without error:

kmeans_spec_tune <- k_means(num_clusters = tune()) |> set_engine("stats", nstarts = 10) kmeans_spec_tune

However, when you add this to a workflow you get the following error:

`x Apparent: preprocessor 1/1, model 1/10: Error in stats::kmeans(data, centers, ...)...

x Apparent: preprocessor 1/1, model 2/10: Error in stats::kmeans(data, centers, ...)...

x Apparent: preprocessor 1/1, model 3/10: Error in stats::kmeans(data, centers, ...)...

x Apparent: preprocessor 1/1, model 4/10: Error in stats::kmeans(data, centers, ...)...

x Apparent: preprocessor 1/1, model 5/10: Error in stats::kmeans(data, centers, ...)...

x Apparent: preprocessor 1/1, model 6/10: Error in stats::kmeans(data, centers, ...)...

x Apparent: preprocessor 1/1, model 7/10: Error in stats::kmeans(data, centers, ...)...

x Apparent: preprocessor 1/1, model 8/10: Error in stats::kmeans(data, centers, ...)...

x Apparent: preprocessor 1/1, model 9/10: Error in stats::kmeans(data, centers, ...)...

x Apparent: preprocessor 1/1, model 10/10: Error in stats::kmeans(data, centers, ......

Warning message:
“All models failed. See the .notes column.”
Error in estimate_tune_results():
! All models failed. Run show_notes(.Last.tune.result) for more information.
Traceback:

  1. collect_metrics(tune_cluster(add_model(add_recipe(workflow(),
    . kmeans_recipe), kmeans_spec_tune), resamples = apparent(clean_beer),
    . grid = beer_ks))
  2. collect_metrics.tune_results(tune_cluster(add_model(add_recipe(workflow(),
    . kmeans_recipe), kmeans_spec_tune), resamples = apparent(clean_beer),
    . grid = beer_ks))
  3. estimate_tune_results(x)
  4. rlang::abort("All models failed. Run show_notes(.Last.tune.result) for more information.")
  5. signal_abort(cnd, .file)`

It would be helpful and informative for the error to come earlier so it is easier to diagnose the problem. Thank you!

@EmilHvitfeldt
Copy link
Member

Hello @katieburak 👋

Thank you for the bug report! I'll try to handle next time I get to do some tidyclust work

@EmilHvitfeldt EmilHvitfeldt added the bug an unexpected problem or unintended behavior label Mar 19, 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

2 participants