Description
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:
- collect_metrics(tune_cluster(add_model(add_recipe(workflow(),
. kmeans_recipe), kmeans_spec_tune), resamples = apparent(clean_beer),
. grid = beer_ks)) - collect_metrics.tune_results(tune_cluster(add_model(add_recipe(workflow(),
. kmeans_recipe), kmeans_spec_tune), resamples = apparent(clean_beer),
. grid = beer_ks)) - estimate_tune_results(x)
- rlang::abort("All models failed. Run
show_notes(.Last.tune.result)
for more information.") - 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!