Skip to content

Error message when nstart is misspecified #181

Open
@katieburak

Description

@katieburak

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions