Skip to content

Commit aaeacb0

Browse files
Balandatfacebook-github-bot
authored andcommitted
Version bump, update deps + readme (#115)
Summary: - peg to (currently non-existing) pytorch version 1.1 - peg to gpytorch 0.3.2 - Update setup.py with classifiers / urls - Overhaul README, add badges, examples, etc Pull Request resolved: #115 Reviewed By: danielrjiang Differential Revision: D15160094 Pulled By: Balandat fbshipit-source-id: 858e77d5ba812121de8e5a3e3648505f7e2d5bf8
1 parent bb6b4bf commit aaeacb0

File tree

6 files changed

+119
-87
lines changed

6 files changed

+119
-87
lines changed

.conda/meta.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ requirements:
1515
host:
1616
- python>=3.6
1717
run:
18-
- pytorch-nightly
19-
- gpytorch
18+
- pytorch>=1.1
19+
- gpytorch>=0.3.2
2020
- scipy
2121

2222
test:

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
No release yet.
1+
# Changelog
2+
3+
The release log for BoTorch.
4+
5+
## [0.1.0] - April 30, 2019
6+
7+
First public beta release.

README.md

+81-44
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
<img width="300" src="./botorch_logo_lockup.svg" alt="BoTorch Logo" />
33
</a>
44

5-
[![Build Status](
6-
https://travis-ci.com/pytorch/botorch.svg?token=esFvpzSw7sLSsfe1PAr1&branch=master
7-
)](https://travis-ci.com/pytorch/botorch)
5+
[![CircleCI](https://circleci.com/gh/pytorch/botorch.svg?style=shield&circle-token=19c388387063692b6d33eecc243c8990a43ae655)](https://circleci.com/gh/pytorch/botorch)
6+
[![Conda](https://img.shields.io/conda/v/pytorch/botorch.svg)](https://anaconda.org/pytorch/botorch)
7+
[![PyPI](https://img.shields.io/pypi/v/botorch.svg)](https://pypi.org/project/botorch)
8+
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE.md)
89

910

1011
BoTorch is a library for Bayesian Optimization built on PyTorch.
1112

12-
*BoTorch is currently in alpha and under active development - be warned*!
13+
*BoTorch is currently in beta and under active development!*
1314

1415

15-
### Why BoTorch
16+
#### Why BoTorch ?
1617
BoTorch
1718
* Provides a modular and easily extensible interface for composing Bayesian
1819
optimization primitives, including probabilistic models, acquisition functions,
@@ -30,30 +31,43 @@ BoTorch
3031
Processes (GPs) deep kernel learning, deep GPs, and approximate inference.
3132

3233

33-
### Target Audience
34+
#### Target Audience
3435

3536
The primary audience for hands-on use of BoTorch are researchers and
3637
sophisticated practitioners in Bayesian Optimization and AI.
37-
3838
We recommend using BoTorch as a low-level API for implementing new algorithms
39-
for [Ax](https://github.com/facebook/Ax). Ax has been designed to be
40-
an easy-to-use platform for end-users, which at the same time is flexible enough
41-
for Bayesian Optimization researchers to plug into for handling of feature
42-
transformations, (meta-)data management, storage, etc.
43-
39+
for [Ax](https://ax.dev). Ax has been designed to be an easy-to-use platform
40+
for end-users, which at the same time is flexible enough for Bayesian
41+
Optimization researchers to plug into for handling of feature transformations,
42+
(meta-)data management, storage, etc.
4443
We recommend that end-users who are not actively doing research on Bayesian
4544
Optimization simply use Ax.
4645

4746

4847
## Installation
4948

50-
#### Installation Requirements
51-
49+
**Installation Requirements**
5250
- Python >= 3.6
53-
- PyTorch nightly (**TODO:** peg to PyTorch 1.1 once released)
54-
- gpytorch >= 0.3.1 (**TODO:** peg to GPyTorch 0.3.2 once released)
51+
- PyTorch >= 1.1
52+
- gpytorch >= 0.3.2
5553
- scipy
5654

55+
56+
#### Installing BoTorch
57+
58+
59+
##### Installing the latest release
60+
61+
The latest release of BoTorch is easily installed either via
62+
[Anaconda](https://www.anaconda.com/distribution/#download-section) (recommended):
63+
```bash
64+
conda install botorch -c pytorch
65+
```
66+
or via `pip`:
67+
```bash
68+
pip install botorch
69+
```
70+
5771
**Important note for MacOS users:**
5872
* You will want to make sure your PyTorch build is linked against MKL (the
5973
non-optimized version of BoTorch can be up to an order of magnitude slower in
@@ -64,52 +78,75 @@ Optimization simply use Ax.
6478
consult the PyTorch installation instructions above.
6579

6680

67-
#### Installing BoTorch
81+
##### Installing from latest master
6882

69-
The latest release of BoTorch is easily installed using either pip or conda:
70-
```bash
71-
pip install botorch
72-
```
73-
74-
**TODO: Conda install**
75-
76-
77-
If you'd like to try our bleeding edge features (and don't mind running into an
78-
occasional bug here or there), you can install the latest master from GitHub
79-
(this will also require installing the current GPyTorch master)::
83+
If you'd like to try our bleeding edge features (and don't mind potentially
84+
running into the occasional bug here or there), you can install the latest
85+
master directly from GitHub (this will also require installing the current GPyTorch master):
8086
```bash
8187
pip install git+https://github.com/cornellius-gp/gpytorch.git
8288
pip install git+https://github.com/pytorch/botorch.git
8389
```
8490

91+
**Manual / Dev install**
8592

86-
#### Installing BoTorch from the private repo **TODO: REMOVE**
87-
88-
BoTorch is easily installed using pip:
89-
```bash
90-
pip install git+ssh://[email protected]/pytorch/botorch.git
91-
```
92-
93-
*Note:* You must use **ssh** here since the repo is private - for this to work,
94-
make sure your ssh public key is registered with GitHub, and is usable by ssh.
95-
96-
Alternatively, you can do a manual install. To do a basic install, run:
93+
Alternatively, you can do a manual install. For a basic install, run:
9794
```bash
95+
git clone https://github.com/pytorch/botorch.git
9896
cd botorch
9997
pip install -e .
10098
```
10199

102-
To customize the installation, you can also run the following instead:
100+
To customize the installation, you can also run the following variants of the
101+
above:
103102
* `pip install -e .[dev]`: Also installs all tools necessary for development
104-
(testing, linting, docs building).
105-
* `pip install -e .[tutorial]`: Also installs jupyter for running the tutorial
106-
notebooks.
103+
(testing, linting, docs building; see [Contributing](#contributing) below).
104+
* `pip install -e .[tutorials]`: Also installs all packages necessary for running the tutorial notebooks.
105+
106+
107+
## Getting Started
108+
109+
Here's a quick run down of the main components of a Bayesian optimization loop.
110+
For more details see our [Documentation](https://botorch.org/docs) and the
111+
[Tutorials](https://botorch.org/tutorials).
112+
113+
1. Fit a Gaussian Process model to data
114+
```python
115+
import torch
116+
from botorch.models import SingleTaskGP
117+
from botorch.fit import fit_gpytorch_model
118+
from gpytorch.mlls import ExactMarginalLogLikelihood
119+
120+
train_X = torch.rand(10, 2)
121+
Y = 1 - torch.norm(train_X - 0.5, dim=-1) + 0.1 * torch.rand(10)
122+
train_Y = (Y - Y.mean()) / Y.std()
123+
124+
gp = SingleTaskGP(train_X, train_Y)
125+
mll = ExactMarginalLogLikelihood(gp.likelihood, gp)
126+
fit_gpytorch_model(mll)
127+
```
128+
129+
2. Construct an acquisition function
130+
```python
131+
from botorch.acquisition import UpperConfidenceBound
132+
133+
UCB = UpperConfidenceBound(gp, beta=0.1)
134+
```
135+
136+
3. Optimize the acquisition function
137+
```python
138+
from botorch.optim import joint_optimize
107139

140+
bounds = torch.stack([torch.zeros(2), torch.ones(2)])
141+
candidate = joint_optimize(
142+
UCB, bounds=bounds, q=1, num_restarts=5, raw_samples=20,
143+
)
144+
```
108145

109146

110147
## Contributing
111148
See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out.
112149

113150

114151
## License
115-
BoTorch is MIT licensed, as found in the LICENSE file.
152+
BoTorch is MIT licensed, as found in the [LICENSE](LICENSE.md) file.

botorch/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .utils import manual_seed
88

99

10-
__version__ = "0.1.0a3"
10+
__version__ = "0.1.0"
1111

1212

1313
__all__ = [

environment.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ channels:
33
- pytorch
44
- gpytorch
55
dependencies:
6-
- pytorch-nightly
7-
- gpytorch
6+
- pytorch>=1.1
7+
- gpytorch>=0.3.2
88
- scipy

setup.py

+26-37
Original file line numberDiff line numberDiff line change
@@ -10,47 +10,27 @@
1010
REQUIRED_MAJOR = 3
1111
REQUIRED_MINOR = 6
1212

13-
fatals = []
14-
15-
1613
# Check for python version
1714
if sys.version_info < (REQUIRED_MAJOR, REQUIRED_MINOR):
18-
fatals.append(
19-
(
20-
"Your version of python ({major}.{minor}) is too old. You need "
21-
"python >= {required_major}.{required_minor}."
22-
).format(
23-
major=sys.version_info.major,
24-
minor=sys.version_info.minor,
25-
required_minor=REQUIRED_MINOR,
26-
required_major=REQUIRED_MAJOR,
27-
)
28-
)
29-
30-
31-
def missing(package_name):
32-
"""Formatting helper for errors."""
33-
fatals.append(
34-
"The '{}' package is missing. Please install it before "
35-
"running the setup script.".format(package_name)
36-
)
37-
38-
39-
# error out if setup dependencies not met
40-
if fatals:
41-
sys.exit(
42-
"You need to fix the following issues before you can install botorch:\n - "
43-
+ "\n - ".join(fatals)
15+
error = (
16+
"Your version of python ({major}.{minor}) is too old. You need "
17+
"python >= {required_major}.{required_minor}."
18+
).format(
19+
major=sys.version_info.major,
20+
minor=sys.version_info.minor,
21+
required_minor=REQUIRED_MINOR,
22+
required_major=REQUIRED_MAJOR,
4423
)
24+
sys.exit(error)
4525

4626

4727
TEST_REQUIRES = ["pytest", "pytest-cov"]
4828

4929
DEV_REQUIRES = TEST_REQUIRES + ["black", "flake8", "sphinx", "sphinx-autodoc-typehints"]
5030

51-
TUTORIAL_REQUIRES = ["jupyter", "matplotlib", "torchvision"]
31+
TUTORIALS_REQUIRES = ["jupyter", "matplotlib", "cma", "torchvision"]
5232

53-
# get version string from setup.py
33+
# get version string from module
5434
with open(os.path.join(os.path.dirname(__file__), "botorch/__init__.py"), "r") as f:
5535
version = re.search(r"__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M).group(1)
5636

@@ -60,18 +40,27 @@ def missing(package_name):
6040
description="Bayesian Optimization in PyTorch",
6141
author="Facebook, Inc.",
6242
license="MIT",
63-
url="https://github.com/pytorch/botorch",
64-
keywords=["Bayesian Optimization", "pytorch", "Gaussian Process"],
43+
url="https://botorch.org",
44+
project_urls={
45+
"Documentation": "https://botorch.org",
46+
"Source": "https://github.com/pytorch/botorch",
47+
"conda": "https://anaconda.org/pytorch/botorch",
48+
},
49+
keywords=["Bayesian optimization", "PyTorch"],
6550
classifiers=[
66-
"Development Status :: 3 - Alpha",
67-
"Programming Language :: Python :: 3",
51+
"Development Status :: 4 - Beta",
52+
"Programming Language :: Python :: 3 :: Only",
53+
"License :: OSI Approved :: MIT License",
54+
"Topic :: Scientific/Engineering",
55+
"Intended Audience :: Science/Research",
56+
"Intended Audience :: Developers",
6857
],
6958
python_requires=">=3.6",
70-
install_requires=["torch>=1.0.1", "gpytorch>=0.3.2", "scipy"],
59+
install_requires=["torch>=1.1", "gpytorch>=0.3.2", "scipy"],
7160
packages=find_packages(),
7261
extras_require={
7362
"dev": DEV_REQUIRES,
7463
"test": TEST_REQUIRES,
75-
"tutorial": TUTORIAL_REQUIRES,
64+
"tutorials": TUTORIALS_REQUIRES,
7665
},
7766
)

0 commit comments

Comments
 (0)