Skip to content

Commit

Permalink
benjamc: Fix merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Actions committed Jul 23, 2024
1 parent f13ba51 commit 2f0abce
Show file tree
Hide file tree
Showing 152 changed files with 420 additions and 322 deletions.
Binary file modified development/.doctrees/api/smac.acquisition.maximizer.doctree
Binary file not shown.
Binary file not shown.
Binary file modified development/.doctrees/environment.pickle
Binary file not shown.
Binary file not shown.
Binary file modified development/.doctrees/examples/1_basics/2_svm_cv.doctree
Binary file not shown.
Binary file modified development/.doctrees/examples/1_basics/3_ask_and_tell.doctree
Binary file not shown.
Binary file modified development/.doctrees/examples/1_basics/4_callback.doctree
Binary file not shown.
Binary file modified development/.doctrees/examples/1_basics/5_continue.doctree
Binary file not shown.
Binary file modified development/.doctrees/examples/1_basics/6_priors.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified development/.doctrees/examples/3_multi_objective/2_parego.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified development/.doctrees/sg_execution_times.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified development/_images/sphx_glr_1_mlp_epochs_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified development/_images/sphx_glr_1_mlp_epochs_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified development/_images/sphx_glr_2_parego_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified development/_images/sphx_glr_2_parego_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@ <h1>Source code for smac.acquisition.maximizer.local_and_random_search</h1><div
<span class="k">class</span> <span class="nc">LocalAndSortedRandomSearch</span><span class="p">(</span><span class="n">AbstractAcquisitionMaximizer</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Implement SMAC&#39;s default acquisition function optimization.</span>

<span class="sd"> This optimizer performs local search from the previous best points according to the acquisition</span>
<span class="sd"> This optimizer performs local search from the previous best points according to the acquisition</span>
<span class="sd"> function, uses the acquisition function to sort randomly sampled configurations.</span>
<span class="sd"> Random configurations are interleaved by the main SMAC code.</span>
Expand All @@ -1058,6 +1059,10 @@ <h1>Source code for smac.acquisition.maximizer.local_and_random_search</h1><div
<span class="sd"> A version of the user-defined ConfigurationSpace where all parameters are uniform (or have their weights removed</span>
<span class="sd"> in the case of a categorical hyperparameter). Can optionally be given and sampling ratios be defined via the</span>
<span class="sd"> `prior_sampling_fraction` parameter.</span>
<span class="sd"> uniform_configspace : ConfigurationSpace</span>
<span class="sd"> A version of the user-defined ConfigurationSpace where all parameters are uniform (or have their weights removed</span>
<span class="sd"> in the case of a categorical hyperparameter). Can optionally be given and sampling ratios be defined via the</span>
<span class="sd"> `prior_sampling_fraction` parameter.</span>
<span class="sd"> acquisition_function : AbstractAcquisitionFunction | None, defaults to None</span>
<span class="sd"> challengers : int, defaults to 5000</span>
<span class="sd"> Number of challengers.</span>
Expand All @@ -1070,6 +1075,9 @@ <h1>Source code for smac.acquisition.maximizer.local_and_random_search</h1><div
<span class="sd"> prior_sampling_fraction: float, defaults to 0.5</span>
<span class="sd"> The ratio of random samples that are taken from the user-defined ConfigurationSpace, as opposed to the uniform</span>
<span class="sd"> version (needs `uniform_configspace`to be defined).</span>
<span class="sd"> prior_sampling_fraction: float, defaults to 0.5</span>
<span class="sd"> The ratio of random samples that are taken from the user-defined ConfigurationSpace, as opposed to the uniform</span>
<span class="sd"> version (needs `uniform_configspace`to be defined).</span>
<span class="sd"> seed : int, defaults to 0</span>
<span class="sd"> &quot;&quot;&quot;</span>

Expand All @@ -1092,6 +1100,28 @@ <h1>Source code for smac.acquisition.maximizer.local_and_random_search</h1><div
<span class="n">seed</span><span class="o">=</span><span class="n">seed</span><span class="p">,</span>
<span class="p">)</span>

<span class="k">if</span> <span class="n">uniform_configspace</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">prior_sampling_fraction</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">prior_sampling_fraction</span> <span class="o">=</span> <span class="mf">0.5</span>
<span class="k">if</span> <span class="n">uniform_configspace</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">prior_sampling_fraction</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;If `prior_sampling_fraction` is given, `uniform_configspace` must be defined.&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">uniform_configspace</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">prior_sampling_fraction</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_prior_random_search</span> <span class="o">=</span> <span class="n">RandomSearch</span><span class="p">(</span>
<span class="n">acquisition_function</span><span class="o">=</span><span class="n">acquisition_function</span><span class="p">,</span>
<span class="n">configspace</span><span class="o">=</span><span class="n">configspace</span><span class="p">,</span>
<span class="n">seed</span><span class="o">=</span><span class="n">seed</span><span class="p">,</span>
<span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_uniform_random_search</span> <span class="o">=</span> <span class="n">RandomSearch</span><span class="p">(</span>
<span class="n">acquisition_function</span><span class="o">=</span><span class="n">acquisition_function</span><span class="p">,</span>
<span class="n">configspace</span><span class="o">=</span><span class="n">uniform_configspace</span><span class="p">,</span>
<span class="n">seed</span><span class="o">=</span><span class="n">seed</span><span class="p">,</span>
<span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_random_search</span> <span class="o">=</span> <span class="n">RandomSearch</span><span class="p">(</span>
<span class="n">configspace</span><span class="o">=</span><span class="n">configspace</span><span class="p">,</span>
<span class="n">acquisition_function</span><span class="o">=</span><span class="n">acquisition_function</span><span class="p">,</span>
<span class="n">seed</span><span class="o">=</span><span class="n">seed</span><span class="p">,</span>
<span class="p">)</span>
<span class="k">if</span> <span class="n">uniform_configspace</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">prior_sampling_fraction</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">prior_sampling_fraction</span> <span class="o">=</span> <span class="mf">0.5</span>
<span class="k">if</span> <span class="n">uniform_configspace</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">prior_sampling_fraction</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
Expand Down Expand Up @@ -1126,6 +1156,8 @@ <h1>Source code for smac.acquisition.maximizer.local_and_random_search</h1><div
<span class="bp">self</span><span class="o">.</span><span class="n">_local_search_iterations</span> <span class="o">=</span> <span class="n">local_search_iterations</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_prior_sampling_fraction</span> <span class="o">=</span> <span class="n">prior_sampling_fraction</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_uniform_configspace</span> <span class="o">=</span> <span class="n">uniform_configspace</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_prior_sampling_fraction</span> <span class="o">=</span> <span class="n">prior_sampling_fraction</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_uniform_configspace</span> <span class="o">=</span> <span class="n">uniform_configspace</span>

<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">acquisition_function</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">AbstractAcquisitionFunction</span> <span class="o">|</span> <span class="kc">None</span><span class="p">:</span> <span class="c1"># noqa: D102</span>
Expand All @@ -1135,6 +1167,11 @@ <h1>Source code for smac.acquisition.maximizer.local_and_random_search</h1><div
<span class="nd">@acquisition_function</span><span class="o">.</span><span class="n">setter</span>
<span class="k">def</span> <span class="nf">acquisition_function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">acquisition_function</span><span class="p">:</span> <span class="n">AbstractAcquisitionFunction</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_acquisition_function</span> <span class="o">=</span> <span class="n">acquisition_function</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_uniform_configspace</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_prior_random_search</span><span class="o">.</span><span class="n">_acquisition_function</span> <span class="o">=</span> <span class="n">acquisition_function</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_uniform_random_search</span><span class="o">.</span><span class="n">_acquisition_function</span> <span class="o">=</span> <span class="n">acquisition_function</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_random_search</span><span class="o">.</span><span class="n">_acquisition_function</span> <span class="o">=</span> <span class="n">acquisition_function</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_uniform_configspace</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_prior_random_search</span><span class="o">.</span><span class="n">_acquisition_function</span> <span class="o">=</span> <span class="n">acquisition_function</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_uniform_random_search</span><span class="o">.</span><span class="n">_acquisition_function</span> <span class="o">=</span> <span class="n">acquisition_function</span>
Expand All @@ -1160,6 +1197,21 @@ <h1>Source code for smac.acquisition.maximizer.local_and_random_search</h1><div
<span class="s2">&quot;local_search&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_local_search</span><span class="o">.</span><span class="n">meta</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_uniform_configspace</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">meta</span><span class="o">.</span><span class="n">update</span><span class="p">(</span>
<span class="p">{</span>
<span class="s2">&quot;random_search&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_random_search</span><span class="o">.</span><span class="n">meta</span><span class="p">,</span>
<span class="s2">&quot;local_search&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_local_search</span><span class="o">.</span><span class="n">meta</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">meta</span><span class="o">.</span><span class="n">update</span><span class="p">(</span>
<span class="p">{</span>
<span class="s2">&quot;prior_random_search&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prior_random_search</span><span class="o">.</span><span class="n">meta</span><span class="p">,</span>
<span class="s2">&quot;uniform_random_search&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_uniform_random_search</span><span class="o">.</span><span class="n">meta</span><span class="p">,</span>
<span class="s2">&quot;local_search&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_local_search</span><span class="o">.</span><span class="n">meta</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">)</span>

<span class="k">return</span> <span class="n">meta</span>

Expand Down Expand Up @@ -1194,6 +1246,9 @@ <h1>Source code for smac.acquisition.maximizer.local_and_random_search</h1><div
<span class="n">_sorted</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="p">)</span>

<span class="c1"># Choose the best self._local_search_iterations random configs to start the local search, and choose only</span>
<span class="c1"># incumbent from previous configs</span>
<span class="n">random_starting_points</span> <span class="o">=</span> <span class="n">next_configs_by_random_search_sorted</span><span class="p">[:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_local_search_iterations</span><span class="p">]</span>
<span class="c1"># Choose the best self._local_search_iterations random configs to start the local search, and choose only</span>
<span class="c1"># incumbent from previous configs</span>
<span class="n">random_starting_points</span> <span class="o">=</span> <span class="n">next_configs_by_random_search_sorted</span><span class="p">[:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_local_search_iterations</span><span class="p">]</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ be applied to problems with large evaluation budgets (up to 1000 evaluations).
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 4.230 seconds)
**Total running time of the script:** (0 minutes 4.357 seconds)


.. _sphx_glr_download_examples_1_basics_1_quadratic_function.py:
Expand Down
2 changes: 1 addition & 1 deletion development/_sources/examples/1_basics/2_svm_cv.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ types as well as conditional hyperparameters.
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 2.871 seconds)
**Total running time of the script:** (0 minutes 2.925 seconds)


.. _sphx_glr_download_examples_1_basics_2_svm_cv.py:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ This examples show how to use the Ask-and-Tell interface.
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 3.813 seconds)
**Total running time of the script:** (0 minutes 3.960 seconds)


.. _sphx_glr_download_examples_1_basics_3_ask_and_tell.py:
Expand Down
2 changes: 1 addition & 1 deletion development/_sources/examples/1_basics/4_callback.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Furthermore, we print some stages of the optimization process.
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 0.157 seconds)
**Total running time of the script:** (0 minutes 0.158 seconds)


.. _sphx_glr_download_examples_1_basics_4_callback.py:
Expand Down
2 changes: 1 addition & 1 deletion development/_sources/examples/1_basics/5_continue.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ there already is a previous run with the same meta data, this run will be contin
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 1.473 seconds)
**Total running time of the script:** (0 minutes 1.536 seconds)


.. _sphx_glr_download_examples_1_basics_5_continue.py:
Expand Down
2 changes: 1 addition & 1 deletion development/_sources/examples/1_basics/6_priors.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ optimization, you have to change the acquisition function to ``PriorAcquisitionF
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 39.241 seconds)
**Total running time of the script:** (0 minutes 39.668 seconds)


.. _sphx_glr_download_examples_1_basics_6_priors.py:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Computation times
=================
**00:51.785** total execution time for 6 files **from examples/1_basics**:
**00:52.605** total execution time for 6 files **from examples/1_basics**:

.. container::

Expand All @@ -33,20 +33,20 @@ Computation times
- Time
- Mem (MB)
* - :ref:`sphx_glr_examples_1_basics_6_priors.py` (``6_priors.py``)
- 00:39.241
- 00:39.668
- 0.0
* - :ref:`sphx_glr_examples_1_basics_1_quadratic_function.py` (``1_quadratic_function.py``)
- 00:04.230
- 00:04.357
- 0.0
* - :ref:`sphx_glr_examples_1_basics_3_ask_and_tell.py` (``3_ask_and_tell.py``)
- 00:03.813
- 00:03.960
- 0.0
* - :ref:`sphx_glr_examples_1_basics_2_svm_cv.py` (``2_svm_cv.py``)
- 00:02.871
- 00:02.925
- 0.0
* - :ref:`sphx_glr_examples_1_basics_5_continue.py` (``5_continue.py``)
- 00:01.473
- 00:01.536
- 0.0
* - :ref:`sphx_glr_examples_1_basics_4_callback.py` (``4_callback.py``)
- 00:00.157
- 00:00.158
- 0.0
Loading

0 comments on commit 2f0abce

Please sign in to comment.