Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BTB Python and dependency versions #217

Merged
merged 4 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion btb/tuning/hyperparams/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _within_search_space(self, values):
values (numpy.ndarray):
2D array of values that will be validated.
"""
self._within_range(values.astype(np.float), min=0, max=1)
self._within_range(values.astype(np.float64), min=0, max=1)

@abstractmethod
def _inverse_transform(self, values):
Expand Down
2 changes: 1 addition & 1 deletion btb/tuning/hyperparams/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, choices, default=NO_DEFAULT):
self.dimensions = len(choices)
self.cardinality = self.dimensions
choices = np.array(choices, dtype='object')
self._encoder = OneHotEncoder(categories=[choices], sparse=False)
self._encoder = OneHotEncoder(categories=[choices], sparse_output=False)
self._encoder.fit(choices.reshape(-1, 1))

def _within_hyperparam_space(self, values):
Expand Down
6 changes: 3 additions & 3 deletions btb/tuning/tuners/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ class BaseTuner:

def __init__(self, tunable, maximize=True):
self.tunable = tunable
self.trials = np.empty((0, self.tunable.dimensions), dtype=np.float)
self.trials = np.empty((0, self.tunable.dimensions), dtype=np.float64)
self._trials_set = set()
self.raw_scores = np.empty((0, 1), dtype=np.float)
self.scores = np.empty((0, 1), dtype=np.float)
self.raw_scores = np.empty((0, 1), dtype=np.float64)
self.scores = np.empty((0, 1), dtype=np.float64)
self.maximize = maximize
LOGGER.debug(
('Creating %s instance with %s hyperparameters and cardinality %s.'),
Expand Down
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@


install_requires = [
'copulas>=0.3.2,<0.4',
'numpy>=1.14.0',
'copulas>=0.3.2,<1',
'numpy>=1.20.0',
'scikit-learn>=0.20.0',
'scipy>=1.2,<2',
'pandas>=1,<2',
'pandas>=1',
'tqdm>=4.36.1,<5',
]

Expand Down Expand Up @@ -90,9 +90,10 @@
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
description='Bayesian Tuning and Bandits',
extras_require={
Expand All @@ -107,7 +108,7 @@
long_description_content_type='text/markdown',
name='baytune',
packages=find_packages(include=['btb', 'btb.*']),
python_requires='>=3.6,<3.9',
python_requires='>=3.8,<3.12',
setup_requires=setup_requires,
test_suite='tests',
tests_require=tests_require,
Expand Down
12 changes: 6 additions & 6 deletions tests/tuning/tuners/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ def test_record_list_maximize_true(self):
instance = MagicMock()
instance.tunable = MagicMock(spec_set=Tunable)
instance.tunable.transform.return_value = np.array([[1, 0]])
instance.trials = np.empty((0, 2), dtype=np.float)
instance.trials = np.empty((0, 2), dtype=np.float64)
instance._trials_set = set()
instance.scores = None
instance.maximize = True
instance.raw_scores = np.empty((0, 1), dtype=np.float)
instance.raw_scores = np.empty((0, 1), dtype=np.float64)

# run
BaseTuner.record(instance, [1], [0.1])
Expand All @@ -268,11 +268,11 @@ def test_record_list_maximize_false(self):
instance = MagicMock()
instance.tunable = MagicMock(spec_set=Tunable)
instance.tunable.transform.return_value = np.array([[1, 0]])
instance.trials = np.empty((0, 2), dtype=np.float)
instance.trials = np.empty((0, 2), dtype=np.float64)
instance._trials_set = set()
instance.scores = None
instance.maximize = False
instance.raw_scores = np.empty((0, 1), dtype=np.float)
instance.raw_scores = np.empty((0, 1), dtype=np.float64)

# run
BaseTuner.record(instance, [1], [0.1])
Expand All @@ -292,8 +292,8 @@ def test_record_scalar_values(self):
# setup
instance = MagicMock()
instance.tunable = MagicMock(spec_set=Tunable)
instance.trials = np.empty((0, 2), dtype=np.float)
instance.raw_scores = np.empty((0, 1), dtype=np.float)
instance.trials = np.empty((0, 2), dtype=np.float64)
instance.raw_scores = np.empty((0, 1), dtype=np.float64)
instance._trials_set = set()
instance.tunable.transform.return_value = np.array([[1, 0]])

Expand Down