Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
Rename samples module to sampler
Browse files Browse the repository at this point in the history
  • Loading branch information
holgern committed Feb 19, 2020
1 parent 198ddde commit bc37008
Show file tree
Hide file tree
Showing 20 changed files with 38 additions and 41 deletions.
18 changes: 9 additions & 9 deletions doc/modules/classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,27 +221,27 @@ details.
utils.point_aslist
utils.use_named_args

.. _samples_ref:
.. _sampler_ref:

:mod:`skopt.samples`: Samples
===============================
:mod:`skopt.sampler`: Samplers
==============================

.. automodule:: skopt.samples
.. automodule:: skopt.sampler
:no-members:
:no-inherited-members:

**User guide:** See the :ref:`sample` section for further details.
**User guide:** See the :ref:`sampler` section for further details.

.. currentmodule:: skopt

.. autosummary::
:toctree: generated/
:template: class.rst

samples.Lhs
samples.Sobol
samples.Halton
samples.Hammersly
sampler.Lhs
sampler.Sobol
sampler.Halton
sampler.Hammersly


.. _space_ref:
Expand Down
6 changes: 6 additions & 0 deletions doc/modules/sampler.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. currentmodule:: skopt.sampler

.. _sampler:

Sampling methods
================
6 changes: 0 additions & 6 deletions doc/modules/samples.rst

This file was deleted.

2 changes: 1 addition & 1 deletion doc/themes/scikit-learn-modern/javascript.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<script>
$(document).ready(function() {
/* Add a [>>>] button on the top-right corner of code samples to hide
/* Add a [>>>] button on the top-right corner of code sampler to hide
* the >>> and ... prompts and the output and thus make the code
* copyable. */
var div = $('.highlight-python .highlight,' +
Expand Down
6 changes: 6 additions & 0 deletions examples/sampler/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. _sampler_examples:

Initial sampling functions
--------------------------

Examples concerning the :mod:`skopt.sampler` module.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
np.random.seed(1234)
import matplotlib.pyplot as plt
from skopt.space import Space
from skopt.samples import Sobol
from skopt.samples import Lhs
from skopt.samples import Halton
from skopt.samples import Hammersly
from skopt.sampler import Sobol
from skopt.sampler import Lhs
from skopt.sampler import Halton
from skopt.sampler import Hammersly
from scipy.spatial.distance import pdist

#############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
np.random.seed(123)
import matplotlib.pyplot as plt
from skopt.space import Space
from skopt.samples import Sobol
from skopt.samples import Lhs
from skopt.samples import Halton
from skopt.samples import Hammersly
from skopt.sampler import Sobol
from skopt.sampler import Lhs
from skopt.sampler import Halton
from skopt.sampler import Hammersly
from scipy.spatial.distance import pdist

#############################################################################
Expand Down
6 changes: 0 additions & 6 deletions examples/samples/README.txt

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
license='BSD 3-clause "New" or "Revised License"',
author='The scikit-optimize contributors',
packages=['skopt', 'skopt.learning', 'skopt.optimizer', 'skopt.space',
'skopt.learning.gaussian_process', 'skopt.samples'],
'skopt.learning.gaussian_process', 'skopt.sampler'],
install_requires=['joblib', 'pyaml', 'numpy', 'scipy>=0.14.0',
'scikit-learn>=0.19.1'],
extras_require={
Expand Down
2 changes: 1 addition & 1 deletion skopt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from . import optimizer

from . import space
from . import samples
from . import sampler
from .optimizer import dummy_minimize
from .optimizer import forest_minimize
from .optimizer import gbrt_minimize
Expand Down
5 changes: 1 addition & 4 deletions skopt/optimizer/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ..acquisition import _gaussian_acquisition
from ..acquisition import gaussian_acquisition_1D
from ..learning import GaussianProcessRegressor
from ..sampler import Sobol, Lhs, Hammersly, Halton
from ..space import Categorical
from ..space import Space
from ..utils import check_x_in_space
Expand Down Expand Up @@ -268,19 +269,15 @@ def __init__(self, dimensions, base_estimator="gp",
if initial_point_generator != "random" and \
isinstance(initial_point_generator, str):
if initial_point_generator == "sobol":
from skopt.samples import Sobol
self._initial_point_generator = Sobol(
**self.init_point_gen_kwargs)
elif initial_point_generator == "halton":
from skopt.samples import Halton
self._initial_point_generator = Halton(
**self.init_point_gen_kwargs)
elif initial_point_generator == "hammersly":
from skopt.samples import Hammersly
self._initial_point_generator = Hammersly(
**self.init_point_gen_kwargs)
elif initial_point_generator == "lhs":
from skopt.samples import Lhs
self._initial_point_generator = Lhs(
**self.init_point_gen_kwargs)
else:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions skopt/tests/test_gp_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


def check_minimize(func, y_opt, bounds, acq_optimizer, acq_func,
margin, n_calls, init_gen="random", n_random_starts=10):
margin, n_calls, n_random_starts=10, init_gen="random"):
r = gp_minimize(func, bounds, acq_optimizer=acq_optimizer,
acq_func=acq_func, n_random_starts=n_random_starts,
n_calls=n_calls, random_state=1,
Expand Down Expand Up @@ -40,7 +40,7 @@ def test_gp_minimize_bench1(search, acq):
@pytest.mark.parametrize("initgen", INITGEN)
def test_gp_minimize_bench1_initgen(search, acq, initgen):
check_minimize(bench1, 0.,
[(-2.0, 2.0)], search, acq, 0.05, 20, initgen)
[(-2.0, 2.0)], search, acq, 0.05, 20, init_gen=initgen)


@pytest.mark.slow_test
Expand Down
6 changes: 3 additions & 3 deletions skopt/tests/test_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
from skopt.space import Integer
from skopt.space import Categorical
from skopt.space import check_dimension as space_check_dimension
from skopt.samples.sobol import _bit_lo0, _bit_hi1
from skopt.samples.halton import _van_der_corput_samples, _create_primes
from skopt.samples import Hammersly, Halton, Lhs, Sobol
from skopt.sampler.sobol import _bit_lo0, _bit_hi1
from skopt.sampler.halton import _van_der_corput_samples, _create_primes
from skopt.sampler import Hammersly, Halton, Lhs, Sobol


@pytest.mark.fast_test
Expand Down

0 comments on commit bc37008

Please sign in to comment.