Skip to content

fix: pass the tuned epsilon to the SGD losses that use it - #1696

Open
Anish Mehta (anishmehta24) wants to merge 1 commit into
microsoft:mainfrom
anishmehta24:fix/sgd-epsilon-losses
Open

Anish Mehta (anishmehta24) wants to merge 1 commit into
microsoft:mainfrom
anishmehta24:fix/sgd-epsilon-losses

Conversation

@anishmehta24

Copy link
Copy Markdown
Contributor

Why are these changes needed?

SGDEstimator tunes epsilon, but config2params keeps it only for loss="modified_huber", which does not use it. sklearn uses epsilon only for huber, epsilon_insensitive and squared_epsilon_insensitive, the regression losses in the search space. So for those losses the tuned value was dropped and every trial ran with the default 0.1:

sgd = SGDEstimator(task="regression", loss="huber", epsilon=0.01)
sgd.fit(X, y)
sgd.model.epsilon  # 0.1 on main

epsilon is now kept for those three losses and dropped for the rest. Classification is unchanged, since sklearn ignored epsilon for log_loss and modified_huber.

Related issue number

None found.

Checks

test_sgd_regression_uses_tuned_epsilon in test/automl/test_model.py fits the three losses with epsilon=0.01; it fails on main and passes now. The sgd reproducibility tests in test_regression.py and test_classification.py and TestExtraModel::test_sgd also pass.

Signed-off-by: Anish Mehta <mehtaanish111@gmail.com>

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.

🟢 Approval recommended

No actionable issues were found in the reviewed changes.

No open issues 🎉

What changed in this PR

Fixes FLAML’s SGD parameter handling so supported regression losses receive the tuned epsilon instead of using sklearn’s default.

Changes:

  • Retains epsilon for huber, epsilon_insensitive, and squared_epsilon_insensitive; removes it for other losses.
  • Adds parameterized tests confirming all three regression losses retain epsilon=0.01 after fitting.
File Description
test/​automl/​test_model.py Adds regression coverage for tuned epsilon values.
flaml/​automl/​model.py Corrects loss-based epsilon filtering in SGDEstimator.

Review effort: Balanced

@thinkall Li Jiang (thinkall) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Whole current PR reviewed at 6108ff137811654338d8fe4cfc2b17c83c7a6cd2.

The complete SGD epsilon-routing correction is clean in this review. The converter retains the configured epsilon for huber, epsilon_insensitive and squared_epsilon_insensitive, and removes it for losses that do not use it. Real estimator-fit tests pass all three affected losses on both pinned stacks (six checks), asserting the fitted model's epsilon is0.01; all six cases fail against the predecessor's default0.1. No contributor source was changed.

The current Build is not successful: the Ray2.4/Python3.10 compatibility job segfaulted with exit139 while running test/fabric/test_ray_reporting.py. Its relationship to this parameter-routing change is not established; it blocks approval regardless. No workflow was rerun automatically.

Independent Low coverage1/1 at maximum reasoning; the original CLEAN outcome is retained. Current-head CI and peer/thread gates are separate approval requirements.

All-files hooks passed for the retained local evidence commit. No contributor source was edited and no review outputs were pushed here.

At 2026-12-04T12:12:30.948707+00:00, checks=FAILURE; actual current-head workflows: Code formatting=completed/success; docs=completed/success; Build=completed/failure. Balanced Copilot approval recommendation=True; unresolved threads=0. Workflow permission is not CI success.

Posted by thinkall-agent-auto-reviewer

@anishmehta24

Copy link
Copy Markdown
Contributor Author

The Ray 2.4 job segfaulted inside pandas read_csv called by ray.tune in test/fabric/test_ray_reporting.py, which this PR does not touch, and the same job passed on the other recent PR runs. Could someone rerun it? I don't have permission to rerun jobs here.

This branch has not been deployed

No deployments
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.

3 participants