Skip to content

[ML] Convert encodeIds flag in TreeEncoder to configuration property - #806

Open
AliRana30 wants to merge 1 commit into
apache:mainfrom
AliRana30:fix/ml-tree-encoder-encode-ids-config-776
Open

AliRana30 wants to merge 1 commit into
apache:mainfrom
AliRana30:fix/ml-tree-encoder-encode-ids-config-776

Conversation

@AliRana30

Copy link
Copy Markdown
Contributor

Summary of Changes

  • Configurable ID Encoding: Replaced the hardcoded final boolean encodeIds = false; in TreeEncoder with wayang.ml.encoding.encode-ids (defaulting to false, with shorthand wayang.ml.encode-ids supported).
  • TreeEncoder Enhancements: Added TreeEncoder(mappings, configuration) constructor, getter/setter for configuration, and overloaded encode methods that resolve encodeIds from OptimizationContext or local configuration.
  • Default Properties: Loaded wayang-ml-defaults.properties in MachineLearning.plugin().setProperties(Configuration) and declared wayang.ml.encoding.encode-ids = false.
  • Unit Tests: Added test cases in TreeEncoderTest verifying default behavior, enabled ID encoding via configuration, and plugin properties loading.

Closes #776.

Copilot AI lite review requested due to automatic review settings September 6, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@AliRana30

Copy link
Copy Markdown
Contributor Author

@zkaoudi Needed your review here.

@zkaoudi
zkaoudi requested a review from mspruc October 8, 2026 11:44
@novatechflow

Copy link
Copy Markdown
Member

Thanks, two issues:

  • Loading the defaults during plugin registration overwrites user configuration, including encode-ids=true, the model path, experience collection, and reoptimization settings.
  • The shorthand wayang.ml.encode-ids=true is ignored after registration because the default canonical property is always present as false.

Reproduced both with focused Java 17 checks. Always preserve user settings, fix shorthand resolution, and add regression tests covering plugin registration.

@AliRana30
AliRana30 force-pushed the fix/ml-tree-encoder-encode-ids-config-776 branch from ab207d3 to 43f2185 Compare October 20, 2026 17:39
@AliRana30

Copy link
Copy Markdown
Contributor Author

Thanks for the review @novatechflow ! Both issues are fixed and tested on Java 17:

  1. User settings preserved: MachineLearning.setProperties now applies a default only if the user hasn't already set it. This covers encode-ids, the model path, experience collection and reoptimization.
  2. Shorthand fixed: wayang.ml.encode-ids=true is no longer shadowed by the default canonical false.
  3. Tests: Added regression tests in TreeEncoderTest for plugin registration and shorthand resolution.

@novatechflow

Copy link
Copy Markdown
Member

The original issues are fixed and covered by regression tests, great progress!

One edge remains: a job-level false cannot override an inherited true when the canonical and shorthand properties differ.

Reproduced on Java 17. Please add parent/child override tests.

@AliRana30
AliRana30 force-pushed the fix/ml-tree-encoder-encode-ids-config-776 branch from 43f2185 to f352aab Compare October 21, 2026 22:07
@AliRana30

AliRana30 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

@novatechflow all your requirements have been added. A job-level false now overrides an inherited true in either direction. Resolution picks the nearest configuration level that sets either spelling, and the plugin no longer injects an encode-ids default that could shadow it. Added parent/child override tests, including 3-level chains and plugin registration.

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.

convert to config

3 participants