Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Move tune imports to new locations (#253)
Browse files Browse the repository at this point in the history
* Move tune imports to new locations

Signed-off-by: Antoni Baum <[email protected]>

* Fix master test

Signed-off-by: Antoni Baum <[email protected]>

* Bump Ray version

Signed-off-by: Antoni Baum <[email protected]>

* Remove debug

Signed-off-by: Antoni Baum <[email protected]>

Signed-off-by: Antoni Baum <[email protected]>
  • Loading branch information
Yard1 authored Oct 5, 2022
1 parent 0e1bd33 commit 0ddd93a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -U pytest
python -m pip install codecov
python -m pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-2.0.0.dev0-cp37-cp37m-manylinux2014_x86_64.whl
python -m pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp37-cp37m-manylinux2014_x86_64.whl
python -m pip install -U -q scikit-learn scikit-optimize hyperopt hpbandster ConfigSpace scipy dataclasses optuna keras
if [ -f requirements-test.txt ]; then python -m pip install -r requirements-test.txt; fi
- name: Install package
Expand Down
4 changes: 2 additions & 2 deletions examples/custom_searcher_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from tune_sklearn import TuneSearchCV
from ray import tune
from ray.tune.suggest.hebo import HEBOSearch
from ray.tune.search.hebo import HEBOSearch
from sklearn.ensemble import RandomForestClassifier
from sklearn import datasets
from sklearn.model_selection import train_test_split
Expand All @@ -28,7 +28,7 @@
searcher = HEBOSearch()

# It is also possible to use user-defined Searchers, as long as
# they inherit from ray.tune.suggest.Searcher and have the following
# they inherit from ray.tune.search.Searcher and have the following
# attributes: _space, _metric, _mode

tune_search = TuneSearchCV(
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@
os.path.join(ROOT_DIR, "README.md"), "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
url="https://github.com/ray-project/tune-sklearn",
install_requires=["scikit-learn", "scipy", "ray[tune]", "numpy>=1.16"])
install_requires=[
"scikit-learn", "scipy", "ray[tune]>=2.0.0", "numpy>=1.16"
])
8 changes: 4 additions & 4 deletions tests/test_randomizedsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def testOptuna(self):
self._test_method("optuna")

def testCustomSearcher(self):
from ray.tune.suggest.hyperopt import HyperOptSearch
from ray.tune.search.hyperopt import HyperOptSearch

class CustomSearcher(HyperOptSearch):
pass
Expand All @@ -708,7 +708,7 @@ class ThisShouldRaiseAnExc:
self._test_method(CustomSearcher())

def testCustomSearcherWithSearchSpaceException(self):
from ray.tune.suggest.hyperopt import HyperOptSearch
from ray.tune.search.hyperopt import HyperOptSearch
from hyperopt import hp

class CustomSearcher(HyperOptSearch):
Expand Down Expand Up @@ -737,7 +737,7 @@ class CustomSearcher(HyperOptSearch):
" its mode") in str(exc.exception))

def testCustomSearcherWithSearchSpace(self):
from ray.tune.suggest.hyperopt import HyperOptSearch
from ray.tune.search.hyperopt import HyperOptSearch
from hyperopt import hp

class CustomSearcher(HyperOptSearch):
Expand Down Expand Up @@ -827,7 +827,7 @@ def testBayesianPointsToEvaluate(self):
self._test_points_to_evaluate("bayesian")

def testHyperoptPointsToEvaluate(self):
from ray.tune.suggest.hyperopt import HyperOptSearch
from ray.tune.search.hyperopt import HyperOptSearch
# Skip test if category conversion is not available
if not hasattr(HyperOptSearch, "_convert_categories_to_indices"):
self.skipTest(f"The current version of Ray does not support the "
Expand Down
2 changes: 1 addition & 1 deletion tune_sklearn/list_searcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

from sklearn.model_selection import ParameterGrid
from ray.tune.suggest.suggestion import Searcher
from ray.tune.search.searcher import Searcher
import random


Expand Down
2 changes: 1 addition & 1 deletion tune_sklearn/tune_basesearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import numbers

import ray
from ray.tune.trial import Trial
from ray.tune.experiment.trial import Trial
from ray.tune.schedulers import (
PopulationBasedTraining, AsyncHyperBandScheduler, HyperBandScheduler,
MedianStoppingRule, TrialScheduler, ASHAScheduler, HyperBandForBOHB)
Expand Down
18 changes: 9 additions & 9 deletions tune_sklearn/tune_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
from sklearn.base import clone

from ray import tune
from ray.tune.sample import Domain
from ray.tune.suggest import (ConcurrencyLimiter, BasicVariantGenerator,
Searcher)
from ray.tune.suggest.bohb import TuneBOHB
from ray.tune.search.sample import Domain
from ray.tune.search import (ConcurrencyLimiter, BasicVariantGenerator,
Searcher)
from ray.tune.search.bohb import TuneBOHB
from ray.tune.schedulers import HyperBandForBOHB
from ray.tune.stopper import CombinedStopper
from ray.tune.suggest.skopt import SkOptSearch
from ray.tune.suggest.hyperopt import HyperOptSearch
from ray.tune.suggest.optuna import OptunaSearch
from ray.tune.search.skopt import SkOptSearch
from ray.tune.search.hyperopt import HyperOptSearch
from ray.tune.search.optuna import OptunaSearch

from tune_sklearn.utils import check_is_pipeline, MaximumIterationStopper
from tune_sklearn.tune_basesearch import TuneBaseSearchCV
Expand Down Expand Up @@ -254,7 +254,7 @@ class TuneSearchCV(TuneBaseSearchCV):
resource_param (max_iter or n_estimators) is
incremented by `max resource value // max_iters`.
search_optimization ("random" or "bayesian" or "bohb" or "hyperopt"
or "optuna" or `ray.tune.suggest.Searcher` instance):
or "optuna" or `ray.tune.search.Searcher` instance):
Randomized search is invoked with ``search_optimization`` set to
``"random"`` and behaves like scikit-learn's
``RandomizedSearchCV``.
Expand Down Expand Up @@ -350,7 +350,7 @@ def __init__(self,
raise ValueError(
"Search optimization must be one of "
f"{', '.join(list(available_optimizations.values()))} "
"or a ray.tune.suggest.Searcher instance.")
"or a ray.tune.search.Searcher instance.")

if isinstance(self._search_optimization_lower, Searcher):
if not hasattr(self._search_optimization_lower,
Expand Down

0 comments on commit 0ddd93a

Please sign in to comment.