Skip to content

Commit

Permalink
Merge pull request #215 from HunterMcGushion/maint/pytest-version-con…
Browse files Browse the repository at this point in the history
…flict

Fix dependency version conflicts. Closes #214
  • Loading branch information
HunterMcGushion committed Oct 21, 2020
2 parents cf4a137 + d2ad8b8 commit e217fd8
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
9 changes: 5 additions & 4 deletions hyperparameter_hunter/compat/keras_optimization_helper.py
Expand Up @@ -46,16 +46,17 @@
##################################################
# Import Learning Assets
##################################################
stderr = sys.stderr
sys.stderr = open(os.devnull, "w")

try:
stderr = sys.stderr
sys.stderr = open(os.devnull, "w")
from keras.callbacks import Callback as base_keras_callback
from keras.initializers import Initializer as BaseKerasInitializer

sys.stderr = stderr
except ModuleNotFoundError:
base_keras_callback = type("PlaceholderBaseKerasCallback", (), {})
BaseKerasInitializer = type("PlaceholderBaseKerasInitializer", (), {})
finally:
sys.stderr = stderr


def keras_prep_workflow(model_initializer, build_fn, extra_params, source_script):
Expand Down
8 changes: 4 additions & 4 deletions hyperparameter_hunter/i_o/recorders.py
Expand Up @@ -90,10 +90,10 @@ def result_path_key(self) -> str:
@abstractmethod
def required_attributes(self) -> list:
"""Return attributes of the current Experiment that are necessary to properly record result.
Specifically, `BaseRecorder` fetches the attrs via :class:`settings.G.Env.current_task`,
which can also be regarded as :class:`environment.Environment.current_task`, but this is
an implementation detail. It is simpler to use :class:`experiments.BaseExperiment`, and its
appropriate descendants as a reference for acceptable values of `required_attributes`"""
Specifically, `BaseRecorder` fetches the attrs via :class:`settings.G.Env.current_task`,
which can also be regarded as :class:`environment.Environment.current_task`, but this is
an implementation detail. It is simpler to use :class:`experiments.BaseExperiment`, and its
appropriate descendants as a reference for acceptable values of `required_attributes`"""

@abstractmethod
def format_result(self):
Expand Down
Expand Up @@ -34,6 +34,7 @@
##################################################
# Import Miscellaneous Assets
##################################################
from joblib import Parallel, delayed
from math import log
from numbers import Number
import numpy as np
Expand All @@ -46,7 +47,6 @@
from scipy.optimize import fmin_l_bfgs_b
from sklearn.base import clone, is_regressor
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.externals.joblib import Parallel, delayed
from sklearn.multioutput import MultiOutputRegressor
from sklearn.utils import check_random_state

Expand Down
14 changes: 10 additions & 4 deletions hyperparameter_hunter/space/space_core.py
Expand Up @@ -197,10 +197,16 @@ def rvs(self, n_samples=1, random_state=None):
columns = []

for dim in self.dimensions:
if sp_version < (0, 16):
columns.append(dim.rvs(n_samples=n_samples))
else:
columns.append(dim.rvs(n_samples=n_samples, random_state=rng))
new_val = None
try:
if sp_version < (0, 16):
new_val = dim.rvs(n_samples=n_samples)
else:
new_val = dim.rvs(n_samples=n_samples, random_state=rng)
except TypeError: # `'<' not supported between instances of 'Version' and 'str'`
new_val = dim.rvs(n_samples=n_samples, random_state=rng)
finally:
columns.append(new_val)

#################### Transpose ####################
rows = []
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Expand Up @@ -43,11 +43,12 @@ def readme():
license="MIT",
packages=find_packages(),
install_requires=[
"joblib",
"nbconvert",
"nbformat",
"numpy",
"pandas",
"scikit-learn",
"scikit-learn<=0.22.2",
"scikit-optimize",
"scipy",
"simplejson",
Expand All @@ -57,7 +58,7 @@ def readme():
"dev": ["pre-commit"],
"docs": ["numpydoc", "hyperparameter-hunter", "keras"],
"travis": [
"pytest>=4.0",
"pytest>=4.6",
"pytest-cov",
"hyperparameter-hunter",
"pyyaml",
Expand All @@ -68,7 +69,7 @@ def readme():
},
include_package_data=True,
zip_safe=False,
tests_require=["pytest>=4.0", "pytest-cov"],
tests_require=["pytest>=4.6", "pytest-cov"],
classifiers=(
"Intended Audience :: Developers",
"Intended Audience :: Education",
Expand Down

0 comments on commit e217fd8

Please sign in to comment.