mirror of
https://github.com/microsoft/autogen.git
synced 2025-09-28 01:28:51 +00:00

* added 'forecast' task with estimators ['fbprophet', 'arima', 'sarimax'] * update setup.py * add TimeSeriesSplit to 'regression' and 'classification' task * add 'time' split_type for 'classification' and 'regression' task Signed-off-by: Kevin Chen <chenkevin.8787@gmail.com> * feature importance * variable name * Update test/test_split.py Co-authored-by: Chi Wang <wang.chi@microsoft.com> * Update test/test_forecast.py Co-authored-by: Chi Wang <wang.chi@microsoft.com> * prophet installation fail in windows * upload flaml_forecast.ipynb Signed-off-by: Kevin Chen <chenkevin.8787@gmail.com>
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
import time
|
|
|
|
|
|
def evaluation_fn(step, width, height):
|
|
return (0.1 + width * step / 100)**(-1) + height * 0.1
|
|
|
|
|
|
def easy_objective(config):
|
|
from ray import tune
|
|
# Hyperparameters
|
|
width, height = config["width"], config["height"]
|
|
|
|
for step in range(config["steps"]):
|
|
# Iterative training function - can be any arbitrary training procedure
|
|
intermediate_score = evaluation_fn(step, width, height)
|
|
# Feed the score back back to Tune.
|
|
tune.report(iterations=step, mean_loss=intermediate_score)
|
|
time.sleep(0.1)
|
|
|
|
|
|
def test_blendsearch_tune(smoke_test=True):
|
|
try:
|
|
from ray import tune
|
|
from ray.tune.suggest import ConcurrencyLimiter
|
|
from ray.tune.schedulers import AsyncHyperBandScheduler
|
|
from ray.tune.suggest.flaml import BlendSearch
|
|
except ImportError:
|
|
print('ray[tune] is not installed, skipping test')
|
|
return
|
|
algo = BlendSearch()
|
|
algo = ConcurrencyLimiter(algo, max_concurrent=4)
|
|
scheduler = AsyncHyperBandScheduler()
|
|
analysis = tune.run(
|
|
easy_objective,
|
|
metric="mean_loss",
|
|
mode="min",
|
|
search_alg=algo,
|
|
scheduler=scheduler,
|
|
num_samples=10 if smoke_test else 100,
|
|
config={
|
|
"steps": 100,
|
|
"width": tune.uniform(0, 20),
|
|
"height": tune.uniform(-100, 100),
|
|
# This is an ignored parameter.
|
|
"activation": tune.choice(["relu", "tanh"])
|
|
})
|
|
|
|
print("Best hyperparameters found were: ", analysis.best_config)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_blendsearch_tune(False)
|