-
Notifications
You must be signed in to change notification settings - Fork 0
Description
What part of the documentation is this about?
This issue is about the general documentation regarding tuning Keras models with kerasnip and visualizing the results using ggplot2::autoplot(). Specifically, it concerns scenarios where multiple parameters of the same type (e.g., units in different dense layers) are tuned.
What is the issue?
When tuning multiple parameters that map to the same underlying dials parameter (e.g., dense1_units and dense2_units both mapping to dials::hidden_units()), ggplot2::autoplot() can fail or produce ambiguous plots. This happens because autoplot() cannot distinguish between these parameters without a unique identifier, leading to errors like "✖ These names are duplicated: * "# Hidden Units" at locations 1 and 2.". The current documentation does not clearly explain how to handle such cases to ensure correct visualization of tuning results.
Suggested improvement
Add a new vignette or a section in an existing vignette (e.g., "Tuning Fit and Compile Arguments") that specifically addresses the issue of tuning multiple similar parameters. This documentation should:
- Explain the problem that arises when
autoplot()tries to visualize results for multiple parameters of the samedialstype without unique identifiers. - Demonstrate the solution: using
tune(id = "unique_id")to provide distinct identifiers for each parameter. - Provide a clear example with a Keras model having multiple dense layers, each with a
unitsparameter being tuned. - Explain why unique
ids are necessary forautoplot()to correctly differentiate and plot the tuning results. - Offer best practices for choosing descriptive
ids.
Additional context
This issue was identified when attempting to tune a Keras sequential model with two layer_dense blocks, each with a units parameter. Without unique ids in the tune() calls, autoplot() failed to generate meaningful plots of the tuning results. The test_autoplot_uniqueness.R test file already demonstrates the correct approach, but this information is not readily available to users in the documentation.