smac


Namesmac JSON
Version 2.0.2 PyPI version JSON
download
home_pagehttps://www.automl.org/
SummarySMAC3, a Python implementation of 'Sequential Model-based Algorithm Configuration'.
upload_time2023-08-01 13:30:07
maintainer
docs_urlNone
authorMarius Lindauer, Katharina Eggensperger, Matthias Feurer, André Biedenkapp, Difan Deng, Carolin Benjamins, Tim Ruhkopf, René Sass and Frank Hutter
requires_python>=3.8
licenseBSD 3-Clause License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SMAC3: A Versatile Bayesian Optimization Package for Hyperparameter Optimization


[![Tests](https://github.com/automl/SMAC3/actions/workflows/pytest.yml/badge.svg?branch=main)](https://github.com/automl/SMAC3/actions/workflows/pytest.yml)
[![Documentation](https://github.com/automl/SMAC3/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/automl/SMAC3/actions/workflows/docs.yml)
[![codecov
Status](https://codecov.io/gh/automl/SMAC3/branch/master/graph/badge.svg)](https://codecov.io/gh/automl/SMAC3)

<img src="docs/images/logo.png" style="width: 50%;" />

SMAC offers a robust and flexible framework for Bayesian Optimization to support users in determining well-performing 
hyperparameter configurations for their (Machine Learning) algorithms, datasets and applications at hand. The main core 
consists of Bayesian Optimization in combination with an aggressive racing mechanism to efficiently decide which of two configurations performs better.

SMAC3 is written in Python3 and continuously tested with Python 3.8, 3.9, and 3.10. Its Random
Forest is written in C++. In further texts, SMAC is representatively mentioned for SMAC3.

> [Documentation](https://automl.github.io/SMAC3)

> [Roadmap](https://github.com/orgs/automl/projects/5/views/2)


## Important: Changes in v2.0

With the next big major release of SMAC, we drastically boosted the user experience by improving the APIs and how the 
pipelining is done (see [changelog](CHANGELOG.md)). All facades/intensifiers support multi-objective, multi-fidelity, 
and multi-threading natively now! That includes having an ask-and-tell interface and continuing a run
wherever you left off. pSMAC is removed because when specifying the number of workers, SMAC automatically uses 
multi-threading for evaluating trials. When cleaning the code base, however, we removed the command-line 
interface (calling a target function from a script is still supported), and runtime optimization. Also,
python 3.7 is not supported anymore. If you depend on those functionalities, please keep using v1.4.

We are excited to introduce the new major release and look forward to developing new features on the new code base. 
We hope you enjoy this new user experience as much as we do. 🚀


## Installation

This instruction is for the installation on a Linux system, for Windows and Mac and further information see the [documentation](https://automl.github.io/SMAC3/main/1_installation.html).

Create a new environment with python 3.10 and make sure swig is installed either on your system or
inside the environment. We demonstrate the installation via anaconda in the following:

Create and activate environment:
```
conda create -n SMAC python=3.10
conda activate SMAC
```

Install swig:
```
conda install gxx_linux-64 gcc_linux-64 swig
```

Install SMAC via PyPI:
```
pip install smac
```

If you want to contribute to SMAC, use the following steps instead:
```
git clone https://github.com/automl/SMAC3.git && cd SMAC3
make install-dev
```


## Minimal Example

```py
from ConfigSpace import Configuration, ConfigurationSpace

import numpy as np
from smac import HyperparameterOptimizationFacade, Scenario
from sklearn import datasets
from sklearn.svm import SVC
from sklearn.model_selection import cross_val_score

iris = datasets.load_iris()


def train(config: Configuration, seed: int = 0) -> float:
    classifier = SVC(C=config["C"], random_state=seed)
    scores = cross_val_score(classifier, iris.data, iris.target, cv=5)
    return 1 - np.mean(scores)


configspace = ConfigurationSpace({"C": (0.100, 1000.0)})

# Scenario object specifying the optimization environment
scenario = Scenario(configspace, deterministic=True, n_trials=200)

# Use SMAC to find the best configuration/hyperparameters
smac = HyperparameterOptimizationFacade(scenario, train)
incumbent = smac.optimize()
```

More examples can be found in the [documentation](https://automl.github.io/SMAC3/main/examples/).

## Visualization via DeepCAVE

With DeepCAVE ([Repo](https://github.com/automl/DeepCAVE), [Paper](https://arxiv.org/abs/2206.03493)) you can visualize your SMAC runs. It is a visualization and analysis tool for AutoML (especially for the sub-problem
hyperparameter optimization) runs.

## License

This program is free software: you can redistribute it and/or modify
it under the terms of the 3-clause BSD license (please see the LICENSE file).

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You should have received a copy of the 3-clause BSD license
along with this program (see LICENSE file).
If not, see [here](https://opensource.org/licenses/BSD-3-Clause).

## Contacting us

If you have trouble using SMAC, a concrete question or found a bug, please create an [issue](https://github.com/automl/SMAC3/issues). This is the easiest way to communicate about these things with us. 

For all other inquiries, please write an email to smac[at]ai[dot]uni[dash]hannover[dot]de.

## Miscellaneous

SMAC3 is developed by the [AutoML Groups of the Universities of Hannover and
Freiburg](http://www.automl.org/).

If you have found a bug, please report to [issues](https://github.com/automl/SMAC3/issues). Moreover, we are 
appreciating any kind of help. Find our guidelines for contributing to this package 
[here](CONTRIBUTING.md).

If you use SMAC in one of your research projects, please cite our 
[JMLR paper](https://jmlr.org/papers/v23/21-0888.html):
```
@article{JMLR:v23:21-0888,
  author  = {Marius Lindauer and Katharina Eggensperger and Matthias Feurer and André Biedenkapp and Difan Deng and Carolin Benjamins and Tim Ruhkopf and René Sass and Frank Hutter},
  title   = {SMAC3: A Versatile Bayesian Optimization Package for Hyperparameter Optimization},
  journal = {Journal of Machine Learning Research},
  year    = {2022},
  volume  = {23},
  number  = {54},
  pages   = {1--9},
  url     = {http://jmlr.org/papers/v23/21-0888.html}
}
```

Copyright (C) 2016-2022  [AutoML Group](http://www.automl.org).

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.automl.org/",
    "name": "smac",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Marius Lindauer, Katharina Eggensperger, Matthias Feurer, Andr\u00e9 Biedenkapp, Difan Deng, Carolin Benjamins, Tim Ruhkopf, Ren\u00e9 Sass and Frank Hutter",
    "author_email": "fh@cs.uni-freiburg.de",
    "download_url": "https://files.pythonhosted.org/packages/a4/72/b2b3752c4edd1f9aa954bc8552c042898708957fb515265d20de041e8a5c/smac-2.0.2.tar.gz",
    "platform": "Linux",
    "description": "# SMAC3: A Versatile Bayesian Optimization Package for Hyperparameter Optimization\n\n\n[![Tests](https://github.com/automl/SMAC3/actions/workflows/pytest.yml/badge.svg?branch=main)](https://github.com/automl/SMAC3/actions/workflows/pytest.yml)\n[![Documentation](https://github.com/automl/SMAC3/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/automl/SMAC3/actions/workflows/docs.yml)\n[![codecov\nStatus](https://codecov.io/gh/automl/SMAC3/branch/master/graph/badge.svg)](https://codecov.io/gh/automl/SMAC3)\n\n<img src=\"docs/images/logo.png\" style=\"width: 50%;\" />\n\nSMAC offers a robust and flexible framework for Bayesian Optimization to support users in determining well-performing \nhyperparameter configurations for their (Machine Learning) algorithms, datasets and applications at hand. The main core \nconsists of Bayesian Optimization in combination with an aggressive racing mechanism to efficiently decide which of two configurations performs better.\n\nSMAC3 is written in Python3 and continuously tested with Python 3.8, 3.9, and 3.10. Its Random\nForest is written in C++. In further texts, SMAC is representatively mentioned for SMAC3.\n\n> [Documentation](https://automl.github.io/SMAC3)\n\n> [Roadmap](https://github.com/orgs/automl/projects/5/views/2)\n\n\n## Important: Changes in v2.0\n\nWith the next big major release of SMAC, we drastically boosted the user experience by improving the APIs and how the \npipelining is done (see [changelog](CHANGELOG.md)). All facades/intensifiers support multi-objective, multi-fidelity, \nand multi-threading natively now! That includes having an ask-and-tell interface and continuing a run\nwherever you left off. pSMAC is removed because when specifying the number of workers, SMAC automatically uses \nmulti-threading for evaluating trials. When cleaning the code base, however, we removed the command-line \ninterface (calling a target function from a script is still supported), and runtime optimization. Also,\npython 3.7 is not supported anymore. If you depend on those functionalities, please keep using v1.4.\n\nWe are excited to introduce the new major release and look forward to developing new features on the new code base. \nWe hope you enjoy this new user experience as much as we do. \ud83d\ude80\n\n\n## Installation\n\nThis instruction is for the installation on a Linux system, for Windows and Mac and further information see the [documentation](https://automl.github.io/SMAC3/main/1_installation.html).\n\nCreate a new environment with python 3.10 and make sure swig is installed either on your system or\ninside the environment. We demonstrate the installation via anaconda in the following:\n\nCreate and activate environment:\n```\nconda create -n SMAC python=3.10\nconda activate SMAC\n```\n\nInstall swig:\n```\nconda install gxx_linux-64 gcc_linux-64 swig\n```\n\nInstall SMAC via PyPI:\n```\npip install smac\n```\n\nIf you want to contribute to SMAC, use the following steps instead:\n```\ngit clone https://github.com/automl/SMAC3.git && cd SMAC3\nmake install-dev\n```\n\n\n## Minimal Example\n\n```py\nfrom ConfigSpace import Configuration, ConfigurationSpace\n\nimport numpy as np\nfrom smac import HyperparameterOptimizationFacade, Scenario\nfrom sklearn import datasets\nfrom sklearn.svm import SVC\nfrom sklearn.model_selection import cross_val_score\n\niris = datasets.load_iris()\n\n\ndef train(config: Configuration, seed: int = 0) -> float:\n    classifier = SVC(C=config[\"C\"], random_state=seed)\n    scores = cross_val_score(classifier, iris.data, iris.target, cv=5)\n    return 1 - np.mean(scores)\n\n\nconfigspace = ConfigurationSpace({\"C\": (0.100, 1000.0)})\n\n# Scenario object specifying the optimization environment\nscenario = Scenario(configspace, deterministic=True, n_trials=200)\n\n# Use SMAC to find the best configuration/hyperparameters\nsmac = HyperparameterOptimizationFacade(scenario, train)\nincumbent = smac.optimize()\n```\n\nMore examples can be found in the [documentation](https://automl.github.io/SMAC3/main/examples/).\n\n## Visualization via DeepCAVE\n\nWith DeepCAVE ([Repo](https://github.com/automl/DeepCAVE), [Paper](https://arxiv.org/abs/2206.03493)) you can visualize your SMAC runs. It is a visualization and analysis tool for AutoML (especially for the sub-problem\nhyperparameter optimization) runs.\n\n## License\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the 3-clause BSD license (please see the LICENSE file).\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\nYou should have received a copy of the 3-clause BSD license\nalong with this program (see LICENSE file).\nIf not, see [here](https://opensource.org/licenses/BSD-3-Clause).\n\n## Contacting us\n\nIf you have trouble using SMAC, a concrete question or found a bug, please create an [issue](https://github.com/automl/SMAC3/issues). This is the easiest way to communicate about these things with us. \n\nFor all other inquiries, please write an email to smac[at]ai[dot]uni[dash]hannover[dot]de.\n\n## Miscellaneous\n\nSMAC3 is developed by the [AutoML Groups of the Universities of Hannover and\nFreiburg](http://www.automl.org/).\n\nIf you have found a bug, please report to [issues](https://github.com/automl/SMAC3/issues). Moreover, we are \nappreciating any kind of help. Find our guidelines for contributing to this package \n[here](CONTRIBUTING.md).\n\nIf you use SMAC in one of your research projects, please cite our \n[JMLR paper](https://jmlr.org/papers/v23/21-0888.html):\n```\n@article{JMLR:v23:21-0888,\n  author  = {Marius Lindauer and Katharina Eggensperger and Matthias Feurer and Andr\u00e9 Biedenkapp and Difan Deng and Carolin Benjamins and Tim Ruhkopf and Ren\u00e9 Sass and Frank Hutter},\n  title   = {SMAC3: A Versatile Bayesian Optimization Package for Hyperparameter Optimization},\n  journal = {Journal of Machine Learning Research},\n  year    = {2022},\n  volume  = {23},\n  number  = {54},\n  pages   = {1--9},\n  url     = {http://jmlr.org/papers/v23/21-0888.html}\n}\n```\n\nCopyright (C) 2016-2022  [AutoML Group](http://www.automl.org).\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "SMAC3, a Python implementation of 'Sequential Model-based Algorithm Configuration'.",
    "version": "2.0.2",
    "project_urls": {
        "Documentation": "https://https://github.com/automl.github.io/SMAC3/main",
        "Homepage": "https://www.automl.org/",
        "Source Code": "https://github.com/https://github.com/automl/smac"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a472b2b3752c4edd1f9aa954bc8552c042898708957fb515265d20de041e8a5c",
                "md5": "7db6f0e6dfed52803576ecdd45f79e3d",
                "sha256": "b49cd5c5dc5d4fc9f0436610136dc368eed971701834a5f745d59abb314c1c9b"
            },
            "downloads": -1,
            "filename": "smac-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7db6f0e6dfed52803576ecdd45f79e3d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 147610,
            "upload_time": "2023-08-01T13:30:07",
            "upload_time_iso_8601": "2023-08-01T13:30:07.650117Z",
            "url": "https://files.pythonhosted.org/packages/a4/72/b2b3752c4edd1f9aa954bc8552c042898708957fb515265d20de041e8a5c/smac-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-01 13:30:07",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "smac"
}
        
Elapsed time: 0.10461s