A programming framework for agentic AI
Change the upper bound for "lags" hyperparameter for sklearn forecast models (#437)
Kevin Chenc75f97b475ba
diff --git a/flaml/model.py b/flaml/model.pyindex 0a1470656..c0ecfddcf 100644--- a/flaml/model.py+++ b/flaml/model.py@@ -1813,7 +1813,10 @@ class TS_SKLearn(SKLearnEstimator):"low_cost_init_value": False,},"lags": {- "domain": tune.randint(lower=1, upper=data_size[0] - pred_horizon),+ "domain": tune.randint(+ lower=1, upper=int(np.sqrt(data_size[0]))++ ),"init_value": 3,},}diff --git a/flaml/tune/sample.py b/flaml/tune/sample.pyindex 113006fe1..c31f36622 100644--- a/flaml/tune/sample.py+++ b/flaml/tune/sample.py@@ -38,6 +38,7 @@ logger = logging.getLogger(__name__)try:from ray.tune.sample import _BackwardsCompatibleNumpyRngexcept ImportError:+class _BackwardsCompatibleNumpyRng:"""Thin wrapper to ensure backwards compatibility betweennew and old numpy randomness generators.diff --git a/test/automl/test_forecast.py b/test/automl/test_forecast.pyindex 3adfb1b45..1715969ef 100644--- a/test/automl/test_forecast.py+++ b/test/automl/test_forecast.py@@ -121,6 +121,23 @@ def test_numpy():print(automl.predict(12))+def test_numpy_large():+ import numpy as np+ import pandas as pd+ from flaml import AutoML++ X_train = pd.date_range("2017-01-01", periods=70000, freq="T")+ y_train = pd.DataFrame(np.random.randint(6500, 7500, 70000))+ automl = AutoML()+ automl.fit(+ X_train=X_train[:-10].values, # a single column of timestamp+ y_train=y_train[:-10].values, # value for each timestamp+ period=10, # time horizon to forecast, e.g., 12 months+ task="ts_forecast",+ time_budget=10, # time budget in seconds+ )++def load_multi_dataset():"""multivariate time series forecasting dataset"""import pandas as pd@@ -429,4 +446,4 @@ if __name__ == "__main__":test_multivariate_forecast_num(60)test_multivariate_forecast_cat(60)test_numpy()- test_forecast_classification()+ test_forecast_classification(60)