Skip to content

Docs: autoplot fails with duplicate parameter names when tuning multiple similar Keras parameters. #32

@davidrsch

Description

@davidrsch

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:

  1. Explain the problem that arises when autoplot() tries to visualize results for multiple parameters of the same dials type without unique identifiers.
  2. Demonstrate the solution: using tune(id = "unique_id") to provide distinct identifiers for each parameter.
  3. Provide a clear example with a Keras model having multiple dense layers, each with a units parameter being tuned.
  4. Explain why unique ids are necessary for autoplot() to correctly differentiate and plot the tuning results.
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions