Basic Usage

There are two ways to use SMAC, either within your Python-code or over the commandline.

Either way, you need to provide a target algorithm you want to optimize and the configuration space, which specifies the legal ranges and default values of the tunable parameters. In addition, you can configure the optimization process with the scenario object.

Python

The usage of SMAC from your Python-code is described in the minimal example. Scenario and configuration space are both build within the code. The target algorithm needs to be registered with a target algorithm, which communicates between SMAC and the target algorithm. To optimize a function, you can instantiate ExecuteTAFuncDict or ExecuteTAFuncArray. In both cases, the algorithm needs to return a cost, representing the quality of the solution. Time- and memory-limits, on the other hand, are measured and enforced by Pynisher.

Commandline

To use SMAC via the commandline, you need a scenario-file and a PCS-file. The script to invoke SMAC is located in scripts/smac. Please see the Branin-example to see how to use it.

SMAC is called via the commandline with the following arguments:

python smac.py --scenario SCENARIO --seed INT --verbose_level LEVEL --mode MODE

Please refer to arguments for more options.

In the scenario file, there are two mandatory parameters: The algo parameter defines how SMAC will call the target algorithm. Parameters will be appended to the call with -PARAMETER VALUE. So make sure your algorithm will accept the parameters in this form. Read more in the section here. The paramfile parameter defines the path to the PCS file, which describes the ranges and default values of the tunable parameters. Both will interpret paths from the execution-directory.

Currently, running SMAC via the commandline will register the algorithm with a Target Algorithm Evaluator, that requires the target algorithm to print the results to the console in the following format (see Branin):

Result for SMAC: <STATUS>, <runtime>, <runlength>, <quality>, <seed>, <instance-specifics>