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

Feature/improve documentation #1028

Merged
merged 14 commits into from
Jun 27, 2023
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 2.0.2

## Improvements
- Add experimental instruction for installing SMAC in windows via a WSL.
- More detailed documentation regarding continuing runs.

## Bugfixes
- Fix bug in the incumbent selection in the case that multi-fidelity is combined with multi-objective (#1019).

Expand Down
49 changes: 49 additions & 0 deletions docs/10_experimental.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Experimental
============

.. warning::
This part is experimental and might not work in each case. If you would like to suggest any changes, please let us know.


Installation in Windows via WSL
------------------------------

SMAC can be installed in a WSL (Windows-Subsystem für Linux) under windows.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentionally Denglish?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it tbh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha no, this was by mistake - fixed.


**1) Install WSL under Windows**

Install WSL under windows. This SMAC installation workflow was tested with Ubuntu 18.04. For Ubuntu 20.04,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows. capitalize

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, should be fixed everywhere now.

it has been observed that the SMAC installation results in a segmentation fault (core dumped).

**2) Get Anaconda**

Download an Anaconda Linux version to drive D under Windows, e.g. \\Anaconda\\Anaconda2-4.2.0-linux-x86_64.sh

In the WSL, Windows resources are mounted under /mnt:

.. code:: bash

cd /mnt/d
bash Anaconda2-4.2.0-linux-x86_64.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this Anaconda2? Probably this might not work with python3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, this is outdated. Put the latest there now.



Enter this command to create the environment variable:

.. code:: bash

export PATH="$PATH:/home/USERNAME/anaconda3/bin
sarah-segel marked this conversation as resolved.
Show resolved Hide resolved

Input 'python' to check if the installation was successful.

**3) Install SMAC**

Change to your home folder and install the general software there:

.. code:: bash

cd /home/USERNAME
sudo apt-get install software-properties-common
sudo apt-get update
sudo apt-get install build-essential swig
conda install gxx_linux-64 gcc_linux-64 swig
curl https://raw.githubusercontent.com/automl/smac3/master/requirements.txt | xargs -n 1 -L 1 pip install
8 changes: 8 additions & 0 deletions docs/1_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,11 @@ You must have `conda >= 4.9` installed. To update conda or check your current co


Read `SMAC feedstock <https://github.com/conda-forge/smac-feedstock>`_ for more details.

Windows via WSL (Experimental)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SMAC can be installed under windows in a WSL (Windows-Subsystem für Linux).
You can find an instruction on how to do this here: :ref:`Experimental<Experimental>`
However, this is experimental and might not work in each case.
If you would like to suggest any changes, please let us know.
17 changes: 12 additions & 5 deletions docs/advanced_usage/10_continue.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
Continue
========

SMAC automatically restores states where it left off if a run was interrupted or finished. To do so, it reads in old
files (derived from scenario's name, output_directory and seed) and sets the components.
SMAC can automatically restore states where it left off if a run was interrupted or prematurely finished. To do so,
it reads in old files (derived from scenario's name, output_directory and seed) and obtains the scenario information
of the previous run from those to continue the run.

The behavior can be controlled by setting the parameter ``overwrite`` in the facade to True or False, respectively:
If set to True, SMAC overwrites the run results if a previous run is found that is consistent in the meta data with
the current setup. If set to False and a previous run is found that is consistent in the meta data,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, what is duplicated? If referring to the "If set to False" being there twice: this is on purpose, as there are two different behaviors in this case. I made this more clear with the enumeration structure.

the run is continued. If set to False and a previous run is found that is not consistent in the meta data, the
user is asked for the exact behaviour (overwrite completely or rename old run first).

.. warning::

If you changed any code and specified a name, SMAC will ask you whether you still want to resume or
delete the old run completely. If you did not specify a name, SMAC generates a new name and the old run is
not affected.
If you changed any code affecting the run's meta data and specified a name, SMAC will ask you whether you still
want to overwrite the old run or rename the old run first. If you did not specify a name, SMAC generates a new name
and the old run is not affected.


Please have a look at our :ref:`continue example<Continue an Optimization>`.
12 changes: 10 additions & 2 deletions examples/1_basics/5_continue.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
Continue an Optimization
^^^^^^^^^^^^^^^^^^^^^^^^

SMAC can also be continued. In this example, an optimization of a simple quadratic
function is continued. We use a custom callback, to artificially stop the first optimization.
SMAC can also be continued from a previous run. To do so, it reads in old files (derived from scenario's name,
output_directory and seed) and sets the corresponding components. In this example, an optimization of a simple quadratic
function is continued.

First, after creating a scenario with 50 trials, we run SMAC with overwrite set to True. This will
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with overwrite set to "True" ? (Emphasize that the word "overwrite' is a parameter in SMAC)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably not worth doing here but typically I like to use parameter_name= for indicating parameters, .attribute_name for indicating attributes and func_name() for functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

overwrite any previous runs (in case the example was called before). We use a custom callback to artificially stop
this first optimization after 10 trials.

Second, we again run the SMAC optimization using the same scenario, but this time with overwrite set to False. As
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

there already is a previous run with the same meta data, this run will be continued until the 50 trials are reached.
"""

from __future__ import annotations
Expand Down
6 changes: 4 additions & 2 deletions smac/facade/abstract_facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ class AbstractFacade:
Callbacks, which are incorporated into the optimization loop.
overwrite: bool, defaults to False
When True, overwrites the run results if a previous run is found that is
inconsistent in the meta data with the current setup. If ``overwrite`` is set to False, the user is asked
for the exact behaviour (overwrite completely, save old run, or use old results).
consistent in the meta data with the current setup. When False and a previous run is found that is
consistent in the meta data, the run is continued. When False and a previous run is found that is
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: Not sure if I misunderstand something, but I would say it needs to be "consistent" instead of "inconsistent" here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you are right

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

not consistent in the meta data, the the user is asked for the exact behaviour (overwrite completely
or rename old run first).
dask_client: Client | None, defaults to None
User-created dask client, which can be used to start a dask cluster and then attach SMAC to it. This will not
be closed automatically and will have to be closed manually if provided explicitly. If none is provided
Expand Down
2 changes: 1 addition & 1 deletion smac/main/smbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def _initialize_state(self) -> None:
logger.info("Since the previous run was not successful, SMAC will start from scratch again.")
self.reset()
else:
# Here, we run into differen scenarios
# Here, we run into different scenarios
diff = recursively_compare_dicts(
Scenario.make_serializable(self._scenario),
Scenario.make_serializable(old_scenario),
Expand Down