Metadata-Version: 2.4
Name: hpobench
Version: 0.0.10
Summary: Benchmark-Suite for Hyperparameter Optimization
Home-page: https://www.automl.org/automl/hpobench/
Author-email: eggenspk@informatik.uni-freiburg.de
License: Apache-2.0
Project-URL: Documentation, https://automl.github.io/HPOBench/
Project-URL: Source Code, https://github.com/automl/HPOBench
Platform: Linux
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Development Status :: 3 - Alpha
Classifier: Natural Language :: English
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: scipy>=1.4.1
Requires-Dist: numpy>=1.18.1
Requires-Dist: ConfigSpace>=0.4.12
Requires-Dist: Pyro4==4.80
Requires-Dist: oslo.concurrency>=4.2.0
Provides-Extra: cartpole
Requires-Dist: tensorflow==1.13.2; extra == "cartpole"
Requires-Dist: gym==0.10.9; extra == "cartpole"
Requires-Dist: tensorforce==0.4.3; extra == "cartpole"
Provides-Extra: codestyle
Requires-Dist: pycodestyle; extra == "codestyle"
Requires-Dist: flake8; extra == "codestyle"
Requires-Dist: pylint; extra == "codestyle"
Provides-Extra: pytest
Requires-Dist: pytest>=4.6; extra == "pytest"
Requires-Dist: pytest-cov; extra == "pytest"
Provides-Extra: test-paramnet
Requires-Dist: tqdm; extra == "test-paramnet"
Requires-Dist: scikit-learn==0.23.2; extra == "test-paramnet"
Provides-Extra: test-tabular-datamanager
Requires-Dist: pyarrow; extra == "test-tabular-datamanager"
Requires-Dist: fastparquet; extra == "test-tabular-datamanager"
Provides-Extra: outlier-detection
Requires-Dist: torch==1.9.0; extra == "outlier-detection"
Requires-Dist: pytorch_lightning==1.3.8; extra == "outlier-detection"
Requires-Dist: scikit-learn==0.24.2; extra == "outlier-detection"
Provides-Extra: ml-tabular-benchmarks
Requires-Dist: tqdm; extra == "ml-tabular-benchmarks"
Requires-Dist: pandas==1.2.4; extra == "ml-tabular-benchmarks"
Requires-Dist: scikit-learn==0.24.2; extra == "ml-tabular-benchmarks"
Requires-Dist: openml==0.12.2; extra == "ml-tabular-benchmarks"
Requires-Dist: xgboost==1.3.1; extra == "ml-tabular-benchmarks"
Provides-Extra: ml-mfbb
Requires-Dist: tqdm; extra == "ml-mfbb"
Requires-Dist: pandas==1.2.4; extra == "ml-mfbb"
Requires-Dist: scikit-learn==0.24.2; extra == "ml-mfbb"
Requires-Dist: openml==0.12.2; extra == "ml-mfbb"
Requires-Dist: xgboost==1.3.1; extra == "ml-mfbb"
Provides-Extra: pybnn
Requires-Dist: Theano==1.0.5; extra == "pybnn"
Requires-Dist: sgmcmc@ git+https://github.com/automl/sgmcmc#egg=sgmcmc-0.0.1 ; extra == "pybnn"
Requires-Dist: Lasagne@ git+https://github.com/Lasagne/Lasagne#egg=Lasagne-0.0.1 ; extra == "pybnn"
Provides-Extra: tabular-benchmarks
Requires-Dist: tensorflow==1.15.0; extra == "tabular-benchmarks"
Provides-Extra: nasbench-1shot1
Requires-Dist: tensorflow==1.15.0; extra == "nasbench-1shot1"
Requires-Dist: matplotlib; extra == "nasbench-1shot1"
Requires-Dist: seaborn; extra == "nasbench-1shot1"
Requires-Dist: networkx; extra == "nasbench-1shot1"
Requires-Dist: tqdm; extra == "nasbench-1shot1"
Provides-Extra: xgboost-example
Requires-Dist: xgboost==0.90; extra == "xgboost-example"
Requires-Dist: json_tricks==3.14.0; extra == "xgboost-example"
Requires-Dist: openml==0.10.2; extra == "xgboost-example"
Provides-Extra: cartpole-example
Requires-Dist: tensorflow==1.13.2; extra == "cartpole-example"
Requires-Dist: gym==0.10.9; extra == "cartpole-example"
Requires-Dist: tensorforce==0.4.3; extra == "cartpole-example"
Requires-Dist: scikit-learn==0.22.0; extra == "cartpole-example"
Requires-Dist: smac==0.12.2; extra == "cartpole-example"
Requires-Dist: hpbandster==0.7.4; extra == "cartpole-example"
Provides-Extra: nasbench-101-example
Requires-Dist: torch<=1.5.1,>=1.2.0; extra == "nasbench-101-example"
Requires-Dist: torchvision>=0.4.0; extra == "nasbench-101-example"
Requires-Dist: nasbench@ git+https://github.com/google-research/nasbench#egg=nasbench-0 ; extra == "nasbench-101-example"
Requires-Dist: nas_benchmarks@ git+https://github.com/automl/nas_benchmarks#egg=nas_benchmarks-0.0.1 ; extra == "nasbench-101-example"
Provides-Extra: svm
Requires-Dist: pandas<0.24.2,>=0.22.2; extra == "svm"
Requires-Dist: openml==0.10.2; extra == "svm"
Requires-Dist: scikit-learn>=0.18.1; extra == "svm"
Provides-Extra: xgboost
Requires-Dist: xgboost==0.90; extra == "xgboost"
Requires-Dist: pandas<1.1.5,>=1.0.0; extra == "xgboost"
Requires-Dist: openml==0.10.2; extra == "xgboost"
Requires-Dist: scikit-learn>=0.18.1; extra == "xgboost"
Provides-Extra: paramnet
Requires-Dist: tqdm; extra == "paramnet"
Requires-Dist: scikit-learn==0.23.2; extra == "paramnet"
Provides-Extra: nasbench-101
Requires-Dist: tensorflow==1.15.0; extra == "nasbench-101"
Requires-Dist: tqdm; extra == "nasbench-101"
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: platform
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# HPOBench

HPOBench is a library for providing benchmarks for (multi-fidelity) hyperparameter optimization and with a focus on reproducibility.

Further info:
  * list of [benchmarks](https://github.com/automl/HPOBench/wiki/Available-Containerized-Benchmarks)
  * [howto](https://github.com/automl/HPOBench/wiki/How-to-add-a-new-benchmark-step-by-step) contribute benchmarks

## Status

Status for Master Branch: 
[![Build Status](https://github.com/automl/HPOBench/workflows/Test%20Pull%20Requests/badge.svg?branch=master)](https://github.com/automl/HPOBench/actions)
[![codecov](https://codecov.io/gh/automl/HPOBench/branch/master/graph/badge.svg)](https://codecov.io/gh/automl/HPOBench)

Status for Development Branch: 
[![Build Status](https://github.com/automl/HPOBench/workflows/Test%20Pull%20Requests/badge.svg?branch=development)](https://github.com/automl/HPOBench/actions)
[![codecov](https://codecov.io/gh/automl/HPOBench/branch/development/graph/badge.svg)](https://codecov.io/gh/automl/HPOBench)

## In 4 lines of code

Evaluate a random configuration using a singularity container
```python
from hpobench.container.benchmarks.nas.tabular_benchmarks import SliceLocalizationBenchmark
b = SliceLocalizationBenchmark(rng=1)
config = b.get_configuration_space(seed=1).sample_configuration()
result_dict = b.objective_function(configuration=config, fidelity={"budget": 100}, rng=1)
```

All benchmarks can also be queried with fewer or no fidelities:

```python
from hpobench.container.benchmarks.nas.tabular_benchmarks import SliceLocalizationBenchmark
b = SliceLocalizationBenchmark(rng=1)
config = b.get_configuration_space(seed=1).sample_configuration()
result_dict = b.objective_function(configuration=config, fidelity={"budget": 50}, rng=1)
# returns results on the highest budget
result_dict = b.objective_function(configuration=config, rng=1)
```

For each benchmark further info on the searchspace and fidelity space can be obtained:

```python
from hpobench.container.benchmarks.nas.tabular_benchmarks import SliceLocalizationBenchmark
b = SliceLocalizationBenchmark(task_id=167149, rng=1)
cs = b.get_configuration_space(seed=1)
fs = b.get_fidelity_space(seed=1)
meta = b.get_meta_information()
```

## Installation

We recommend using a virtual environment. To install HPOBench, please run the following:
```
git clone https://github.com/automl/HPOBench.git
cd HPOBench 
pip install .
```

**Note:** This does not install *singularity (version 3.6)*. Please follow the steps described here: [user-guide](https://sylabs.io/guides/3.6/user-guide/quick_start.html#quick-installation-steps).   
If you run into problems, using the most recent singularity version might help: [here](https://singularity.hpcng.org/admin-docs/master/installation.html)

## Containerized Benchmarks

We provide all benchmarks as containerized versions to (i) isolate their dependencies and (ii) keep them reproducible. Our containerized benchmarks do not rely on external dependencies and thus do not change over time. For this, we rely on [Singularity (version 3.6)](https://sylabs.io/guides/3.6/user-guide/) and for now upload all containers to a [gitlab registry](https://gitlab.tf.uni-freiburg.de/muelleph/hpobench-registry/container_registry)

The only other requirements are: [ConfigSpace](https://github.com/automl/ConfigSpace), *scipy* and *numpy* 

### Run a Benchmark Locally

Each benchmark can also be run locally, but the dependencies must be installed manually and might conflict with other benchmarks. This can be arbitrarily complex and further information can be found in the docstring of the benchmark.
 
A simple example is the XGBoost benchmark which can be installed with `pip install .[xgboost]`

```python
from hpobench.benchmarks.ml.xgboost_benchmark_old import XGBoostBenchmark

b = XGBoostBenchmark(task_id=167149)
config = b.get_configuration_space(seed=1).sample_configuration()
result_dict = b.objective_function(configuration=config,
                                   fidelity={"n_estimators": 128, "dataset_fraction": 0.5}, rng=1)

```

### How to Build a Container Locally

With singularity installed run the following to built the, e.g. xgboost container

```bash
cd hpobench/container/recipes/ml
sudo singularity build xgboost_benchmark Singularity.XGBoostBenchmark
```

You can use this local image with:

```python
from hpobench.container.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark
b = XGBoostBenchmark(task_id=167149, container_name="xgboost_benchmark", 
                     container_source='./') # path to hpobench/container/recipes/ml
config = b.get_configuration_space(seed=1).sample_configuration()
result_dict = b.objective_function(config, fidelity={"n_estimators": 128, "dataset_fraction": 0.5})
```

## Configure HPOBench

All of HPOBench's settings are stored in a file, the `hpobenchrc`-file. It is a .yaml file, which is automatically generated at the first use of HPOBench. 
By default, it is placed in `$XDG_CONFIG_HOME` (or if not set this defaults to `'~/.config/hpobench'`). This file defines where to store containers and datasets and much more. We highly recommend to have a look at this file once it's created. Furthermore, please make sure to have write permission in these directories or adapt if necessary. For more information on where data is stored, please see the section on `HPOBench Data` below.

Furthermore, for running containers, we rely on Unix sockets which by default are located in `$TEMP_DIR` (or if not set this defaults to `\tmp`). 

### Remove all data, containers, and caches

Feel free to use `hpobench/util/clean_up_script.py` to remove all data, downloaded containers and caches:
```bash
python ./hpobench/util/clean_up_script.py --help
``` 

If you like to delete only specific parts, i.e. a single container, you can find the benchmark's data, container, and caches in the following directories:

#### HPOBench Data
HPOBench stores downloaded containers and datasets at the following locations:

```bash
$XDG_CONFIG_HOME # ~/.config/hpobench
$XDG_CACHE_HOME # ~/.cache/hpobench
$XDG_DATA_HOME # ~/.local/share/hpobench
```

For crashes or when not properly shutting down containers, there might be socket files left under `/tmp/hpobench_socket`.

#### OpenML Data

OpenML data additionally maintains its cache which is located at `~/.openml/`

#### Singularity Containers

Singularity additionally maintains its cache which can be removed with `singularity cache clean`

### Use HPOBench Benchmarks in Research Projects

If you use a benchmark in your experiments, please specify the version number of the HPOBench as well as the version of 
the used container to ensure reproducibility. When starting an experiment, HPOBench writes automatically these two version numbers to the log. 

### Troubleshooting and Further Notes

  - **Singularity throws an 'Invalid Image format' exception**
  Use a singularity version > 3. For users of the Meta-Cluster in Freiburg, you have to set the following path:
  ```export PATH=/usr/local/kislurm/singularity-3.5/bin/:$PATH```

  - **A Benchmark fails with `SystemError: Could not start an instance of the benchmark. Retried 5 times` but the container 
can be started locally with `singularity instance start <pathtocontainer> test`**
See whether in `~/.singularity/instances/sing/$HOSTNAME/*/` there is a file that does not end with '}'. If yes delete this file and retry.   

**Note:** If you are looking for a different or older version of our benchmarking library, you might be looking for
 [HPOlib1.5](https://github.com/automl/HPOlib1.5) 
 
## Reference

If you use HPOBench, please cite the following paper:

```bibtex
@inproceedings{
  eggensperger2021hpobench,
  title={{HPOB}ench: A Collection of Reproducible Multi-Fidelity Benchmark Problems for {HPO}},
  author={Katharina Eggensperger and Philipp M{\"u}ller and Neeratyoy Mallik and Matthias Feurer and Rene Sass and Aaron Klein and Noor Awad and Marius Lindauer and Frank Hutter},
  booktitle={Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2)},
  year={2021},
  url={https://openreview.net/forum?id=1k4rJYEwda-}
}
```

