spotpython - Sequential Parameter Optimization in Python
Project description
spotpython
Sequential Parameter Optimization in Python
- spotpython is a Python version of the well-known hyperparameter tuner SPOT, which has been developed in the R programming environment for statistical analysis for over a decade [bart21i].
- spotpython is a sequential model-based optimization (SMBO) method [BLP05].
Installation
- Installation can be done with
pip
:
pip install spotpython
spotpython Documentation
-
Hyperparameter-tuning Cookbook: A guide for scikit-learn, PyTorch, river, and spotpython. Available at https://sequential-parameter-optimization.github.io/spotpython/.
-
Bartz-Beielstein (2023). PyTorch Hyperparameter Tuning --- A Tutorial for spotpython (Working Paper).
Abstract: The goal of hyperparameter tuning (or hyperparameter optimization) is to optimize the hyperparameters to improve the performance of the machine or deep learning model. spotpython ("Sequential Parameter Optimization Toolbox in Python") is the Python version of the well-known hyperparameter tuner SPOT, which has been developed in the R programming environment for statistical analysis for over a decade. PyTorch is an optimized tensor library for deep learning using GPUs and CPUs. This document shows how to integrate the spotpython hyperparameter tuner into the PyTorch training workflow. As an example, the results of the CIFAR10 image classifier are used. In addition to an introduction to spotpython, this tutorial also includes a brief comparison with Ray Tune, a Python library for running experiments and tuning hyperparameters. This comparison is based on the PyTorch hyperparameter tuning tutorial. The advantages and disadvantages of both approaches are discussed. We show that spotpython achieves similar or even better results while being more flexible and transparent than Ray Tune.
spotpython Features
-
Some of the advantages of
spotpython
are:- Numerical and categorical hyperparameters.
- Powerful surrogate models.
- Flexible approach and easy to use.
- Simple JSON files for the specification of the hyperparameters.
- Extension of default and user specified network classes.
- Noise handling techniques.
- Tensorboard interaction.
Citation
@ARTICLE{bart23earxiv,
author = {{Bartz-Beielstein}, Thomas},
title = "{PyTorch Hyperparameter Tuning -- A Tutorial for spotpython}",
journal = {arXiv e-prints},
keywords = {Computer Science - Machine Learning, Computer Science - Artificial Intelligence, Mathematics - Numerical Analysis, 68T07, A.1, B.8.0, G.1.6, G.4, I.2.8},
year = 2023,
month = may,
eid = {arXiv:2305.11930},
pages = {arXiv:2305.11930},
doi = {10.48550/arXiv.2305.11930},
archivePrefix = {arXiv},
eprint = {2305.11930},
primaryClass = {cs.LG},
adsurl = {https://ui.adsabs.harvard.edu/abs/2023arXiv230511930B},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
@book{bart21i,
editor = {Bartz,Eva and Bartz-Beielstein, Thomas and Zaefferer, Martin and Mersmann, Olaf},
isbn = {ISBN 978-981-19-5169-5},
keywords = {bartzPublic},
note = {in print},
publisher = {Springer},
title = {{Hyperparameter Tuning for Machine and Deep Learning with R - A Practical Guide}},
year = {2022}
url = {https://link.springer.com/book/10.1007/978-981-19-5170-1}
}
@inproceedings{BLP05,
author = {Bartz-Beielstein, Thomas and Lasarczyk, Christian and Preuss, Mike},
title = {{Sequential Parameter Optimization}},
booktitle = {{Proceedings 2005 Congress on Evolutionary Computation (CEC'05), Edinburgh, Scotland}},
date-added = {2016-10-30 11:44:52 +0000},
date-modified = {2021-07-22 12:12:43 +0200},
doi = {10.1109/CEC.2005.1554761},
editor = {McKay, B and others},
isbn = {0-7803-9363-5},
issn = {1089-778X},
pages = {773--780},
publisher = {{IEEE Press}},
address = {Piscataway NJ},
year = {2005},
url= {http://dx.doi.org/10.1109/CEC.2005.1554761}
}
Appendix
- This appendix contains some information on how to setup the development environment for spotpython. Information provided here is not required for the installation of spotpython.
Styleguide
Follow the Google Python Style Guide from https://google.github.io/styleguide/pyguide.html.
Python
-
Mac Users: Install brew
brew install python
andbrew install graphviz
etc.
-
Generate and activate a virtual environment, see venv, e.g.,
cd ~; python3 -m venv .venv
source ~/.venv/bin/activate
Python mkdocs
python -m pip install mkdocs mkdocs-gen-files mkdocs-literate-nav mkdocs-section-index mkdocs-material
mkdocs build
mkdocs serve
http://127.0.0.1:8000/
Optimizing/Profiling Code
Editor/IDE
- Optional: Install visualstudio
- Optional: Install quarto
Package Building
Local Setup
- This information is based on https://packaging.python.org/en/latest/tutorials/packaging-projects/
- Information is stored in
pyproject.toml
(setup.py
is not used anymore.) - A
src
folder is used for the package sources. - The following files are used for the package building:
pyproject.toml
: see pyproject.toml.- Important: Follow the instructions from https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html for including data files (like *.csv, *.tar, etc.). These files can be specified in the following
MANIFEST
file:MANIFEST
: see MANIFEST. It describes the data files to be included, e.g.:include src/spotpython/data/*.rst
LICENSE
: see LICENSE
Local Installation
- Perform the following steps to install the package:
- Make sure you have the latest version of PyPA’s build installed:
python3 -m pip install --upgrade build
- Start the package building process via:
python3 -m build
- This command should output a lot of text and once completed should generate two files in the
dist
directory. - You can use the local
spotpython*.tar.gz
file from thedist
folder for your package installation withpip
, e.g.; python3 -m pip install ./dist/spotpython-0.0.1.tar.gz
- Make sure you have the latest version of PyPA’s build installed:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file spotpython-0.18.3.tar.gz
.
File metadata
- Download URL: spotpython-0.18.3.tar.gz
- Upload date:
- Size: 294.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce18066df8815119846e8963dd25a6304123afe4a99d7e50c19c981f71229905 |
|
MD5 | 06a8977f6dd95f73420c55436c2c6193 |
|
BLAKE2b-256 | 18c0b607cd36b3d22e88d5c30f4996fb80756c9dd85d7234ae23745d0659ca96 |
File details
Details for the file spotpython-0.18.3-py3-none-any.whl
.
File metadata
- Download URL: spotpython-0.18.3-py3-none-any.whl
- Upload date:
- Size: 233.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbb916d9b6e729d9e0bc596bca0547bba5c7405dc52b150a7c9ee8573e70eb9e |
|
MD5 | 1e5d385ee1ab0bd3c32b96235cde8170 |
|
BLAKE2b-256 | 163429e6ab0fb1911ffc0c1d15bb29b9497eea1185355d8193dba7d2969caec4 |