Repository: microsoft/FLAML (language: python)

Issue:
[Bug]: Inconsistency in ElasticNet due to lack of random state
### Describe the bug

This is a nit-pick issue, but I extended the regression reproducibility tests locally to include ElasticNet.
I struggle to consistently reproduce the loss shown by FLAML, and I'm pretty sure this is due to not fixing a random state on the FLAML `ElasticNetEstimator`. Two runs of `test_reproducibility_of_underlying_regression_models[enet]` return four different results, for example:

![Image](https://github.com/user-attachments/assets/48e3bca1-a82b-4f66-ab51-8d4eea5166d8)

![Image](https://github.com/user-attachments/assets/3b79cf31-2163-4731-b229-a89d8c7b0783)

Now of course these are very close, but there might be cases where the two results differ more. As part of this issue it would be good to fix a default random state to this ElasticNet estimator (as is done with many other estimators) and also to add 'enet' to `test_reproducibility_of_underlying_regression_models[enet]` and `test_reproducibility_of_regression_models[enet]`, so that we can be sure of the reproducibility of this estimator going forwards.


Discussion / hints:

Fix patch:
diff --git a/flaml/automl/model.py b/flaml/automl/model.py
index 12c3dca361..8e3b88e6a4 100644
--- a/flaml/automl/model.py
+++ b/flaml/automl/model.py
@@ -2429,6 +2429,11 @@ def config2params(self, config: dict) -> dict:
 
     def __init__(self, task="regression", **config):
         super().__init__(task, **config)
+        self.params.update(
+            {
+                "random_state": config.get("random_seed", 10242048),
+            }
+        )
         assert self._task.is_regression(), "ElasticNet for regression task only"
         self.estimator_class = ElasticNet
 


Test patch:
diff --git a/test/automl/test_regression.py b/test/automl/test_regression.py
index 0bef79990f..87f8ed6b23 100644
--- a/test/automl/test_regression.py
+++ b/test/automl/test_regression.py
@@ -236,6 +236,7 @@ def test_multioutput():
     "estimator",
     [
         "catboost",
+        "enet",
         "extra_tree",
         "histgb",
         "kneighbor",
@@ -342,6 +343,7 @@ def test_reproducibility_of_catboost_regression_model():
     "estimator",
     [
         "catboost",
+        "enet",
         "extra_tree",
         "histgb",
         "kneighbor",
@@ -385,7 +387,6 @@ def test_reproducibility_of_underlying_regression_models(estimator: str):
             automl._state.X_train_all, automl._state.y_train_all, automl._state.kf, best_model.model, "regression"
         )
     )
-
     assert pytest.approx(val_loss_flaml) == reproduced_val_loss_underlying_model