Repository navigation
fix: keep unordered categorical choices intact in FLOW2 local search - #1680
Anish Mehta (anishmehta24) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change preserving tuple values and mixed Python types in categorical choices.
No open issues 🎉
What changed in this PR
This PR fixes FLOW2’s handling of unordered categorical choices, preserving tuple values and mixed Python types during local search.
Changes:
- Selects an alternative category by index to avoid NumPy array conversion.
- Adds regression tests for tuple and mixed-type choices, plus CFO integration tests for tuple search spaces.
| File | Description |
|---|---|
test/tune/test_unordered_categorical.py |
Tests category value/type preservation and CFO exploration of tuple choices. |
flaml/tune/space.py |
Samples an index and returns the original category without coercion. |
Review effort: Balanced
Li Jiang (thinkall)
left a comment
There was a problem hiding this comment.
Whole-PR Low review at b4ae289722110f0e64d0d1364359c6fa99ab0932: category-index selection preserves tuple and heterogeneous category values. Targeted suites passed 12 tests versus 12 expected failures on the main control.
One low-priority test-setup issue remains: a preconstructed CFO() ignores low_cost_partial_config passed only to tune.run. Both native stacks retain an empty init config and start at a sampled x, not the declared x=0. Use CFO(low_cost_partial_config={"x": 0}) and remove the ignored run argument.
Approval is also blocked by the actual Ubuntu 3.12 Build failure: 42 failed, 549 passed and 13 skipped, with YAML parser errors reading generated MLflow mlruns/.../meta.yaml. Those failures were not attributed to this category patch without a reproducing control, and were not ignored or rerun. A Balanced approval recommendation does not replace successful CI.
The original issue-found verdict and local evidence are retained; no review outputs were pushed to this PR.
Posted by thinkall-agent-auto-reviewer
|
Changed the test to The 3.12 failures all read one broken |
Li Jiang (thinkall)
left a comment
There was a problem hiding this comment.
Whole-PR review at 0af0e78db6d66d8730d7051f08ca51bfd8904480 is clean. The CFO regression now configures its integer low-cost starting point through the constructor. The finite search visits multiple valid tuple categories without incorrectly requiring all 30 requested evaluations to complete.
Both native stacks pass the six targeted cases (12 passes total), and the real fixture starts at x=0. The same new tests produce 12 expected failures on explicitly source-verified unmodified main. The original unpinned-main positives were not accepted as baseline proof. This is targeted validation, not a full optional-dependency or supported-version matrix.
All-files pre-commit passed. The current-head Balanced Copilot review explicitly recommends approval, all threads are resolved, applicable checks are successful, and actual current-head Build, docs and formatting workflow runs completed successfully. The docs release-only job is explicitly disabled for pull requests by its verified source condition; no pending or unsuccessful workflow is ignored.
Approved. Review evidence is retained only in a detached local worktree and was not pushed to this PR.
Posted by thinkall-agent-auto-reviewer
Why are these changes needed?
When FLOW2 moves an unordered categorical away from the incumbent,
denormalizepicks the new value withrandom_state.choice(...)on the remaining categories. NumPy turns that list into an array first, so:tune.choice([(1, 2), (3, 4), (5, 6)])ortune.choice([(16,), (32,), (16, 16)])raiseValueError(a must be 1-dimensional/ inhomogeneous shape), which stopstune.runwith CFO or BlendSearch;["sqrt", "log2", 0.5]gives the string'0.5', and[True, False, "auto"]gives the string'False'.It now draws an index and returns the category itself, as
Categoricalsampling insample.pyalready does. For a given seed the same category is picked as before.Related issue number
None found.
Checks
test/tune/test_unordered_categorical.pycallsdenormalizewith the four category lists above and runs CFO on the two tuple spaces; all 6 cases fail on main and pass with the change.pytest test/tunepasses (test_no_optunadeselected: it callspip uninstalland fails the same way on main in my venv).