Skip to content

Conversation

davidrsch
Copy link
Owner

This PR fixes a bug where tuning compile_optimizer or compile_loss would fail because the tune framework was incorrectly looking for their corresponding dials functions in the dials namespace instead of the kerasnip namespace.

The key changes are:

  • R/register_model_args.R:
    • The logic for registering model arguments has been corrected to first check for a full argument name match (e.g., compile_optimizer) in the keras_dials_map before attempting to match a base name (e.g., units).
    • A condition has been added to correctly set the pkg to "kerasnip" for the custom dials functions (optimizer_function and loss_function_keras) defined in this package.
  • tests/testthat/test_e2e_fit_compile_tuning.R:
    • A comprehensive end-to-end test has been added to verify that all core fit_* and compile_* arguments can be tuned simultaneously.
    • This test uses the dials update() function and the custom optimizer_function and loss_function_keras functions to ensure the fix is working as expected.

Closes #24

Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@davidrsch davidrsch merged commit 8d90f69 into main Sep 9, 2025
11 of 12 checks passed
@davidrsch davidrsch deleted the register_model_args_iss branch September 9, 2025 14:30
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.

Bug report: Tuning with custom compile_* arguments fails due to incorrect namespace lookup
1 participant