Skip to content

Commit 2fe6e93

Browse files
authored
Rename HPOlib -> HPOBench, hpolib -> hpobench (#61)
* Rename HPOlib -> HPOBench, hpolib -> hpobench * Fix Tests * Fix Tests * Fix Tests * Fix Example
1 parent 528e4f3 commit 2fe6e93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+269
-276
lines changed

README.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# HPOlib2
1+
# HPOBench
22

3-
HPOlib2 is a library for hyperparameter optimization and black-box optimization benchmark with a focus on reproducibility.
3+
HPOBench is a library for hyperparameter optimization and black-box optimization benchmark with a focus on reproducibility.
44

5-
**Note:** Hpolib2 is under active construction. Stay tuned for more benchmarks. Information on how to contribute a new benchmark will follow shortly.
5+
**Note:** HPOBench is under active construction. Stay tuned for more benchmarks. Information on how to contribute a new benchmark will follow shortly.
66

7-
**Note:** If you are looking for a different version of HPOlib2, you might be looking for [HPOlib1.5](https://github.com/automl/HPOlib1.5)
7+
**Note:** If you are looking for a different version of HPOBench, you might be looking for [HPOlib1.5](https://github.com/automl/HPOlib1.5)
88

99
## In 4 lines of code
1010

1111
Run a random configuration within a singularity container
1212
```python
13-
from hpolib.container.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark
13+
from hpobench.container.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark
1414
b = XGBoostBenchmark(task_id=167149, container_source='library://phmueller/automl', rng=1)
1515
config = b.get_configuration_space(seed=1).sample_configuration()
1616
result_dict = b.objective_function(configuration=config, fidelity={"n_estimators": 128, "subsample": 0.5}, rng=1)
@@ -19,7 +19,7 @@ result_dict = b.objective_function(configuration=config, fidelity={"n_estimators
1919
All benchmarks can also be queried with fewer or no fidelities:
2020

2121
```python
22-
from hpolib.container.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark
22+
from hpobench.container.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark
2323
b = XGBoostBenchmark(task_id=167149, container_source='library://phmueller/automl', rng=1)
2424
config = b.get_configuration_space(seed=1).sample_configuration()
2525
result_dict = b.objective_function(configuration=config, fidelity={"n_estimators": 128,}, rng=1)
@@ -35,7 +35,7 @@ Further requirements are: [ConfigSpace](https://github.com/automl/ConfigSpace),
3535

3636
A simple example is the XGBoost benchmark which can be installed with `pip install .[xgboost]`
3737
```python
38-
from hpolib.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark
38+
from hpobench.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark
3939
b = XGBoostBenchmark(task_id=167149)
4040
config = b.get_configuration_space(seed=1).sample_configuration()
4141
result_dict = b.objective_function(configuration=config, fidelity={"n_estimators": 128, "subsample": 0.5}, rng=1)
@@ -47,8 +47,8 @@ result_dict = b.objective_function(configuration=config, fidelity={"n_estimators
4747
Before we start, we recommend using a virtual environment. To run any benchmark using its singularity container,
4848
run the following:
4949
```
50-
git clone https://github.com/automl/HPOlib2.git
51-
cd HPOlib2
50+
git clone https://github.com/automl/HPOBench.git
51+
cd HPOBench
5252
pip install .
5353
```
5454

@@ -78,29 +78,29 @@ pip install .
7878
With singularity installed run the following to built the xgboost container
7979

8080
```bash
81-
cd hpolib/container/recipes/ml
81+
cd hpobench/container/recipes/ml
8282
sudo singularity build xgboost_benchmark Singularity.XGBoostBenchmark
8383
```
8484

8585
You can use this local image with:
8686

8787
```python
88-
from hpolib.container.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark
88+
from hpobench.container.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark
8989
b = XGBoostBenchmark(task_id=167149, container_name="xgboost_benchmark",
90-
container_source='./') # path to hpolib/container/recipes/ml
90+
container_source='./') # path to hpobench/container/recipes/ml
9191
config = b.get_configuration_space(seed=1).sample_configuration()
9292
result_dict = b.objective_function(config, fidelity={"n_estimators": 128, "subsample": 0.5})
9393
```
9494

9595
### Remove all caches
9696

97-
#### HPOlib data
98-
HPOlib stores downloaded containers and datasets at the following locations:
97+
#### HPOBench data
98+
HPOBench stores downloaded containers and datasets at the following locations:
9999

100100
```bash
101-
$XDG_CONFIG_HOME # ~/.config/hpolib2
102-
$XDG_CACHE_HOME # ~/.config/hpolib2
103-
$XDG_DATA_HOME # ~/.cache/hpolib2
101+
$XDG_CONFIG_HOME # ~/.config/hpobench
102+
$XDG_CACHE_HOME # ~/.config/hpobench
103+
$XDG_DATA_HOME # ~/.cache/hpobench
104104
```
105105

106106
For crashes or when not properly shutting down containers, there might be socket files left under `/tmp/`.
@@ -127,10 +127,10 @@ See whether in `~/.singularity/instances/sing/$HOSTNAME/*/` there is a file that
127127

128128
Status for Master Branch:
129129

130-
[![Build Status](https://travis-ci.org/automl/HPOlib2.svg?branch=master)](https://travis-ci.org/automl/HPOlib2)
131-
[![codecov](https://codecov.io/gh/automl/HPOlib2/branch/master/graph/badge.svg)](https://codecov.io/gh/automl/HPOlib2)
130+
[![Build Status](https://travis-ci.org/automl/HPOBench.svg?branch=master)](https://travis-ci.org/automl/HPOBench)
131+
[![codecov](https://codecov.io/gh/automl/HPOBench/branch/master/graph/badge.svg)](https://codecov.io/gh/automl/HPOBench)
132132

133133
Status for Development Branch:
134134

135-
[![Build Status](https://travis-ci.org/automl/HPOlib2.svg?branch=development)](https://travis-ci.org/automl/HPOlib2)
136-
[![codecov](https://codecov.io/gh/automl/HPOlib2/branch/development/graph/badge.svg)](https://codecov.io/gh/automl/HPOlib2)
135+
[![Build Status](https://travis-ci.org/automl/HPOBench.svg?branch=development)](https://travis-ci.org/automl/HPOBench)
136+
[![codecov](https://codecov.io/gh/automl/HPOBench/branch/development/graph/badge.svg)](https://codecov.io/gh/automl/HPOBench)

changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# 0.0.5
2+
* Rename package to HPOBench
23

34
# 0.0.4
45
* improve test coverage

ci_scripts/codestyle.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
if [[ "$RUN_CODESTYLE" == "true" ]]; then
44
echo "Performing codestyle checking"
55

6-
test_codestyle=$(pycodestyle --max-line-length=120 ./hpolib)
6+
test_codestyle=$(pycodestyle --max-line-length=120 ./hpobench)
77
if [[ $test_codestyle ]]; then
88
echo $test_codestyle
99
exit 1
1010
else
1111
echo "Codesytle: No errors found"
1212
fi
1313

14-
test_flake=$(flake8 --max-line-length=120 ./hpolib)
14+
test_flake=$(flake8 --max-line-length=120 ./hpobench)
1515
if [[ $test_flake ]]; then
1616
echo $test_flake
1717
exit 1

ci_scripts/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ fi
6868

6969
# remove the trailing comma
7070
install_packages="$(echo ${install_packages} | sed 's/,*\r*$//')"
71-
echo "Install HPOlib2 with options: ${install_packages}"
71+
echo "Install HPOBench with options: ${install_packages}"
7272
pip install .["${install_packages}"]

ci_scripts/script.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
if [[ "$RUN_TESTS" == "true" ]]; then
44
if [[ "$RUN_CODECOV" == "true" ]]; then
55
echo "Run tests with code coverage"
6-
pytest -sv --cov=hpolib tests/
6+
pytest -sv --cov=hpobench tests/
77
exit_code=$?
88

99
echo "Run code coverage"

codecov.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ comment:
2020
require_changes: no
2121

2222
ignore:
23-
- "hpolib/benchmarks"
24-
- "hpolib/util/dependencies.py"
25-
- "hpolib/util/example_utils.py"
23+
- "hpobench/benchmarks"
24+
- "hpobench/util/dependencies.py"
25+
- "hpobench/util/example_utils.py"

examples/container/tabular_benchmark_example.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
container_source can be either a path to a registry (e.g. sylabs.io, singularity_hub.org) or a local path on your local
1010
file system. If it is a link to a registry, the container will be downloaded to the default data dir, set in the
11-
hpolibrc. A second call, will first look into the data directory, if the container is already available, so it will not
11+
hpobenchrc. A second call, will first look into the data directory, if the container is already available, so it will not
1212
be downloaded twice.
1313
1414
Please install the necessary dependencies via ``pip install .`` and singularity (v3.5).
@@ -17,7 +17,7 @@
1717

1818
import argparse
1919

20-
from hpolib.container.benchmarks.nas.tabular_benchmarks import SliceLocalizationBenchmark as TabBenchmarkContainer
20+
from hpobench.container.benchmarks.nas.tabular_benchmarks import SliceLocalizationBenchmark as TabBenchmarkContainer
2121

2222

2323
def run_experiment(on_travis=False):

examples/container/xgboost_with_container.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
================================
44
55
In this example, we show how to use a benchmark with a container. We provide container for some benchmarks.
6-
They are hosted on https://cloud.sylabs.io/library/keggensperger/automl.
6+
They are hosted on https://cloud.sylabs.io/library/muelleph/automl.
77
88
Furthermore, we use different fidelities to train the xgboost model - the number of estimators as well as the fraction
99
of training data points.
1010
1111
To use the container-example, you have to have singulartiy (>3.5) installed. Follow the official installation guide on
1212
https://sylabs.io/guides/3.1/user-guide/quick_start.html#quick-installation-steps
1313
14-
Furthermore, make sure to install the right dependencies for the hpolib via:
14+
Furthermore, make sure to install the right dependencies for the hpobench via:
1515
``pip3 install .``.
1616
"""
1717

1818
import argparse
1919
import logging
2020
from time import time
2121

22-
from hpolib.container.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark as Benchmark
23-
from hpolib.util.openml_data_manager import get_openmlcc18_taskids
22+
from hpobench.container.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark as Benchmark
23+
from hpobench.util.openml_data_manager import get_openmlcc18_taskids
2424

2525
logging.basicConfig(level=logging.INFO)
2626

@@ -66,7 +66,7 @@ def run_experiment(on_travis: bool = False):
6666

6767

6868
if __name__ == '__main__':
69-
parser = argparse.ArgumentParser(prog='HPOlib CC Datasets', description='HPOlib2 on the CC18 data sets.',
69+
parser = argparse.ArgumentParser(prog='HPOBench CC Datasets', description='HPOBench on the CC18 data sets.',
7070
usage='%(prog)s --array_id <task_id>')
7171

7272
parser.add_argument('--on_travis', action='store_true',

examples/local/xgboost_local.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import argparse
1111
from time import time
1212

13-
from hpolib.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark as Benchmark
14-
from hpolib.util.openml_data_manager import get_openmlcc18_taskids
13+
from hpobench.benchmarks.ml.xgboost_benchmark import XGBoostBenchmark as Benchmark
14+
from hpobench.util.openml_data_manager import get_openmlcc18_taskids
1515

1616

1717
def run_experiment(on_travis: bool = False):
@@ -51,7 +51,7 @@ def run_experiment(on_travis: bool = False):
5151

5252

5353
if __name__ == '__main__':
54-
parser = argparse.ArgumentParser(prog='HPOlib CC Datasets', description='HPOlib2 on the CC18 data sets.',
54+
parser = argparse.ArgumentParser(prog='HPOBench CC Datasets', description='HPOBench on the CC18 data sets.',
5555
usage='%(prog)s --array_id <task_id>')
5656

5757
parser.add_argument('--on_travis', action='store_true',

examples/w_optimizer/cartpole_bohb.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
from hpbandster.core.worker import Worker
1919
from hpbandster.optimizers import BOHB
2020

21-
from hpolib.container.benchmarks.rl.cartpole import CartpoleReduced as Benchmark
22-
from hpolib.util.example_utils import get_travis_settings, set_env_variables_to_use_only_one_core
23-
from hpolib.util.rng_helper import get_rng
21+
from hpobench.container.benchmarks.rl.cartpole import CartpoleReduced as Benchmark
22+
from hpobench.util.example_utils import get_travis_settings, set_env_variables_to_use_only_one_core
23+
from hpobench.util.rng_helper import get_rng
2424

2525
logger = logging.getLogger('BOHB on cartpole')
2626
set_env_variables_to_use_only_one_core()
@@ -116,8 +116,8 @@ def run_experiment(out_path, on_travis):
116116

117117
if __name__ == '__main__':
118118
import argparse
119-
parser = argparse.ArgumentParser(prog='HPOlib - BOHB',
120-
description='HPOlib2 with BOHB on Cartpole',
119+
parser = argparse.ArgumentParser(prog='HPOBench - BOHB',
120+
description='HPOBench with BOHB on Cartpole',
121121
usage='%(prog)s --out_path <string>')
122122
parser.add_argument('--out_path', default='./cartpole_smac_hb', type=str)
123123
parser.add_argument('--on_travis', action='store_true',

examples/w_optimizer/cartpole_hyperband.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from smac.intensification.hyperband import Hyperband
1818
from smac.scenario.scenario import Scenario
1919

20-
from hpolib.container.benchmarks.rl.cartpole import CartpoleReduced as Benchmark
21-
from hpolib.util.example_utils import get_travis_settings, set_env_variables_to_use_only_one_core
20+
from hpobench.container.benchmarks.rl.cartpole import CartpoleReduced as Benchmark
21+
from hpobench.util.example_utils import get_travis_settings, set_env_variables_to_use_only_one_core
2222

2323
logger = logging.getLogger("HB on cartpole")
2424
logging.basicConfig(level=logging.INFO)
@@ -93,8 +93,8 @@ def optimization_function_wrapper(cfg, seed, instance, budget):
9393

9494
if __name__ == "__main__":
9595
import argparse
96-
parser = argparse.ArgumentParser(prog='HPOlib - Hyperband',
97-
description='HPOlib2 with HB on Cartpole',
96+
parser = argparse.ArgumentParser(prog='HPOBench - Hyperband',
97+
description='HPOBench with HB on Cartpole',
9898
usage='%(prog)s --out_path <string>')
9999
parser.add_argument('--out_path', default='./cartpole_smac_hb', type=str)
100100
parser.add_argument('--on_travis', action='store_true',

examples/w_optimizer/cartpole_succesive_halving.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from smac.intensification.hyperband import SuccessiveHalving
1818
from smac.scenario.scenario import Scenario
1919

20-
from hpolib.container.benchmarks.rl.cartpole import CartpoleReduced as Benchmark
21-
from hpolib.util.example_utils import get_travis_settings, set_env_variables_to_use_only_one_core
20+
from hpobench.container.benchmarks.rl.cartpole import CartpoleReduced as Benchmark
21+
from hpobench.util.example_utils import get_travis_settings, set_env_variables_to_use_only_one_core
2222

2323
logger = logging.getLogger("SH on cartpole")
2424
logging.basicConfig(level=logging.INFO)
@@ -96,8 +96,8 @@ def optimization_function_wrapper(cfg, seed, instance, budget):
9696

9797
if __name__ == "__main__":
9898
import argparse
99-
parser = argparse.ArgumentParser(prog='HPOlib - Successive Halving',
100-
description='HPOlib2 with SH on Cartpole',
99+
parser = argparse.ArgumentParser(prog='HPOBench - Successive Halving',
100+
description='HPOBench with SH on Cartpole',
101101
usage='%(prog)s --out_path <string>')
102102
parser.add_argument('--out_path', default='./cartpole_smac_sh', type=str)
103103
parser.add_argument('--on_travis', action='store_true',

hpolib/HowToAddANewBenchmark.md renamed to hpobench/HowToAddANewBenchmark.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## Create a local benchmark
44

5-
Clone Hpolib2, switch to the development branch and create your own branch, then install hpolib2.
5+
Clone HPOBench, switch to the development branch and create your own branch, then install hpobench.
66
with `pip install .`
77
```bash
8-
git clone https://github.com/automl/HPOlib2.git
9-
cd HPOlib2
8+
git clone https://github.com/automl/HPOBench.git
9+
cd HPOBench
1010
git checkout development
1111
git branch newBenchmark
1212
git checkout newBenchmark
@@ -15,21 +15,21 @@ pip install .
1515

1616
Then:
1717

18-
1. Implement your new benchmark `hpolib/benchmarks/<type>/<name>` inheriting from the base class
19-
`AbstractBenchmark` in `hpolib.abstract_benchmark`. Your benchmark should implement `__init__()`,
18+
1. Implement your new benchmark `hpobench/benchmarks/<type>/<name>` inheriting from the base class
19+
`AbstractBenchmark` in `hpobench.abstract_benchmark`. Your benchmark should implement `__init__()`,
2020
`get_configuration_space()`, `get_fidelity_space()`, `objective_function()` and `objective_function_test()`.
21-
A good example for this can be found in `hpolib/benchmarks/ml/xgboost_benchmark.py`
21+
A good example for this can be found in `hpobench/benchmarks/ml/xgboost_benchmark.py`
2222
3. If your benchmarks needs a dataset (e.g. for training a ml model), please also implement a DataManager, see e.g.
23-
`hpolib/util/openml_data_manager.py` with a `load()` method that downloads data once and reuses it for further calls.
23+
`hpobench/util/openml_data_manager.py` with a `load()` method that downloads data once and reuses it for further calls.
2424
4. Collect all **additional Python** and **non-Python** dependencies while doing this.
2525
Consider fixing the version of each dependency to maintain reproducibility.
2626
5. Add dependencies to PIPy in a new file to `/extra_requirements`
2727
6. Add the remaining dependencies or steps necessary to run your benchmark in the docstring of your benchmark class
28-
(see, e.g. `hpolib/benchmarks/nas/nasbench_101.py`).
28+
(see, e.g. `hpobench/benchmarks/nas/nasbench_101.py`).
2929
7. Verify that everything works with, e.g.
3030

3131
```python
32-
from hpolib.benchmarks.<type>.<newbenchmark> import <NewBenchmark>
32+
from hpobench.benchmarks.<type>.<newbenchmark> import <NewBenchmark>
3333
b = <NewBenchmark>(<some_args>, rng=1)
3434
config = b.get_configuration_space(seed=1).sample_configuration()
3535
result_dict = b.objective_function(configuration=config, rng=1)
@@ -42,21 +42,21 @@ Now, you can create a PR marked as [WIP] and proceed with building a containeriz
4242

4343
## Create a containerized benchmark
4444

45-
1. Create a container benchmark class in `hpolib/container/benchmarks/<type>/<name>` inheriting from the
46-
base class `AbstractBenchmarkClient` in `hpolib.container.client_abstract_benchmark`.
47-
Note: this are just a few lines of code, see, e.g. `hpolib/container/benchmarks/ml/xgboost_benchmark.py`)
48-
2. Copy `hpolib/container/recipes/Singularity.template` to `hpolib/container/recipes/<type>/name`
45+
1. Create a container benchmark class in `hpobench/container/benchmarks/<type>/<name>` inheriting from the
46+
base class `AbstractBenchmarkClient` in `hpobench.container.client_abstract_benchmark`.
47+
Note: this are just a few lines of code, see, e.g. `hpobench/container/benchmarks/ml/xgboost_benchmark.py`)
48+
2. Copy `hpobench/container/recipes/Singularity.template` to `hpobench/container/recipes/<type>/name`
4949
3. Modify the recipe and add your **additional Python** and **non-Python** dependencies collected above.
5050
3. Test your container locally (see below)
5151

5252
Now, you can update your PR and let us know, so we can upload the container to Sylabs. Thanks.
5353

5454
## How to test your container locally
5555

56-
1. `cd hpolib/container/benchmarks/recipes/<type>` and change to following lines in the recipe:
56+
1. `cd hpobench/container/benchmarks/recipes/<type>` and change to following lines in the recipe:
5757
```bash
58-
&& git clone https://github.com/automl/HPOlib2.git \
59-
&& cd HPOlib2 \
58+
&& git clone https://github.com/automl/HPOBench.git \
59+
&& cd HPOBench \
6060
&& git checkout development \
6161
```
6262
to point to the branch/repo where your fork is on, e.g. `newBenchmark`.
@@ -65,7 +65,7 @@ Now, you can update your PR and let us know, so we can upload the container to S
6565
3. Verify that everything works with:
6666

6767
```python
68-
from hpolib.container.benchmarks.<type>.<newbenchmark> import <NewBenchmark>
68+
from hpobench.container.benchmarks.<type>.<newbenchmark> import <NewBenchmark>
6969
b = <NewBenchmark>(container_source="./", container_name="newBenchmark")
7070
res = b.objective_function(configuration=b.get_configuration_space(seed=1).sample_configuration())
7171
```

hpobench/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
__contact__ = "automl.org"
2+
3+
from hpobench.__version__ import __version__ # noqa: F401
4+
from hpobench.config import config_file # noqa: F401
File renamed without changes.

0 commit comments

Comments
 (0)