Skip to content
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
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ RUN pip install mpld3 && \
pip install missingno && \
pip install pandas-profiling && \
pip install s2sphere && \
pip install git+https://github.com/fmfn/BayesianOptimization.git && \
pip install bayesian-optimization && \
pip install matplotlib-venn && \
pip install pyldavis && \
pip install mlxtend && \
Expand Down Expand Up @@ -283,8 +283,7 @@ RUN pip install --upgrade cython && \
pip install fasttext && \
apt-get install -y libhunspell-dev && pip install hunspell && \
pip install annoy && \
# Need to use CountEncoder from category_encoders before it's officially released
pip install git+https://github.com/scikit-learn-contrib/categorical-encoding.git && \
pip install category_encoders && \
# google-cloud-automl 2.0.0 introduced incompatible API changes, need to pin to 1.0.1
pip install google-cloud-automl==1.0.1 && \
# Newer version crashes (latest = 1.14.0) when running tensorflow.
Expand Down Expand Up @@ -347,8 +346,7 @@ RUN pip install bcolz && \
pip install --upgrade Pillow && \
# Install openslide and its python binding
apt-get install -y openslide-tools && \
# b/152402322 install latest from pip once is in: https://github.com/openslide/openslide-python/pull/76
pip install git+git://github.com/rosbo/openslide-python.git@fix-setup && \
pip install openslide-python && \
pip install ptyprocess && \
pip install Pygments && \
pip install pyparsing && \
Expand Down
32 changes: 32 additions & 0 deletions tests/test_bayes_opt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import unittest

from bayes_opt import BayesianOptimization


class TestBayesOpt(unittest.TestCase):
def test_optimize(self):
# Bounded region of parameter space
pbounds = {'x': (2, 4), 'y': (-3, 3)}

optimizer = BayesianOptimization(
f=black_box_function,
pbounds=pbounds,
random_state=1,
)

optimizer.maximize(
init_points=2,
n_iter=1,
)

self.assertAlmostEqual(-7, optimizer.max['target'], places=0) # compares using 0 decimal


def black_box_function(x, y):
"""Function with unknown internals we wish to maximize.

This is just serving as an example, for all intents and
purposes think of the internals of this function, i.e.: the process
which generates its output values, as unknown.
"""
return -x ** 2 - (y - 1) ** 2 + 1
8 changes: 4 additions & 4 deletions tests/test_category_encoders.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import unittest

from category_encoders import CountEncoder
import pandas as pd


## Need to make sure we have CountEncoder available from the category_encoders library
class TestCategoryEncoders(unittest.TestCase):
def test_count_encoder(self):

from category_encoders import CountEncoder
import pandas as pd

encoder = CountEncoder(cols="data")

data = pd.DataFrame([1, 2, 3, 1, 4, 5, 3, 1], columns=["data"])
Expand Down