Skip to content

Conversation

davidrsch
Copy link
Owner

This pull request addresses a common pitfall when tuning Keras models with kerasnip and visualizing results using ggplot2::autoplot().

Problem:
When a Keras model specification includes multiple parameters that map to the same underlying dials parameter type (e.g., units in different layer_dense blocks), autoplot() can fail. This occurs because autoplot() cannot distinguish between these parameters without unique identifiers, leading to errors such as "Names must be unique" due to duplicated column names like "# Hidden Units".

Solution:

  1. New Vignette: Introduces a new vignette, articles/autoplot_uniqueness.Rmd, which clearly explains the problem and demonstrates the solution.
  2. Unique ids for tune(): The vignette emphasizes the importance of providing unique ids to the tune() function for each similar parameter (e.g., dense1_units = tune(id = "dense_layer_one_units")). This allows autoplot() to correctly differentiate and plot the tuning results for each distinct parameter.
  3. pkgdown Integration: The _pkgdown.yml file has been updated to include the new vignette in the navigation bar under the "Tuning" section.

This change significantly improves the documentation by providing clear guidance on a crucial aspect of kerasnip usage, helping users avoid common visualization errors during model tuning.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link

codecov bot commented Sep 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@davidrsch davidrsch merged commit 9a76df6 into main Sep 13, 2025
11 of 12 checks passed
@davidrsch davidrsch deleted the tune_autoplot_doc branch September 18, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: autoplot fails with duplicate parameter names when tuning multiple similar Keras parameters.
1 participant