@@ -19,8 +19,8 @@ const bash = (...args) => `~~~bash\n${String.raw(...args)}\n~~~`;
1919
2020class HomeSplash extends React . Component {
2121 render ( ) {
22- const { siteConfig, language = '' } = this . props ;
23- const { baseUrl, docsUrl} = siteConfig ;
22+ const { siteConfig, language = '' } = this . props ;
23+ const { baseUrl, docsUrl } = siteConfig ;
2424 const docsPart = `${ docsUrl ? `${ docsUrl } /` : '' } ` ;
2525 const langPart = `${ language ? `${ language } /` : '' } ` ;
2626 const docUrl = doc => `${ baseUrl } ${ docsPart } ${ langPart } ${ doc } ` ;
@@ -79,8 +79,8 @@ class HomeSplash extends React.Component {
7979
8080class Index extends React . Component {
8181 render ( ) {
82- const { config : siteConfig , language = '' } = this . props ;
83- const { baseUrl} = siteConfig ;
82+ const { config : siteConfig , language = '' } = this . props ;
83+ const { baseUrl } = siteConfig ;
8484
8585 const Block = props => (
8686 < Container
@@ -114,34 +114,38 @@ class Index extends React.Component {
114114 const modelFitCodeExample = `${ pre } python
115115import torch
116116from botorch.models import SingleTaskGP
117+ from botorch.models.transforms import Normalize, Standardize
117118from botorch.fit import fit_gpytorch_mll
118- from botorch.utils import standardize
119119from gpytorch.mlls import ExactMarginalLogLikelihood
120120
121- train_X = torch.rand(10, 2, dtype=torch.double)
121+ train_X = torch.rand(10, 2, dtype=torch.double) * 2
122122Y = 1 - torch.linalg.norm(train_X - 0.5, dim=-1, keepdim=True)
123123Y = Y + 0.1 * torch.randn_like(Y) # add some noise
124- train_Y = standardize(Y)
125124
126- gp = SingleTaskGP(train_X, train_Y)
125+ gp = SingleTaskGP(
126+ train_X=train_X,
127+ train_Y=Y,
128+ input_transform=Normalize(d=2),
129+ outcome_transform=Standardize(m=1),
130+ )
127131mll = ExactMarginalLogLikelihood(gp.likelihood, gp)
128132fit_gpytorch_mll(mll)
129133 ` ;
130134 // Example for defining an acquisition function
131135 const constrAcqFuncExample = `${ pre } python
132- from botorch.acquisition import UpperConfidenceBound
136+ from botorch.acquisition import LogExpectedImprovement
133137
134- UCB = UpperConfidenceBound( gp, beta=0.1 )
138+ logNEI = LogExpectedImprovement(model= gp, best_f=Y.max() )
135139 ` ;
136140 // Example for optimizing candidates
137141 const optAcqFuncExample = `${ pre } python
138142from botorch.optim import optimize_acqf
139143
140- bounds = torch.stack([torch.zeros(2), torch.ones(2)])
144+ bounds = torch.stack([torch.zeros(2), torch.ones(2)]).to(torch.double)
141145candidate, acq_value = optimize_acqf(
142- UCB , bounds=bounds, q=1, num_restarts=5, raw_samples=20,
146+ logNEI , bounds=bounds, q=1, num_restarts=5, raw_samples=20,
143147)
144- candidate # tensor([0.4887 , 0.5063] )
148+ candidate # tensor([[0.2981 , 0.2401]], dtype=torch.float64 )
145149 ` ;
146150 const papertitle = `BoTorch: A Framework for Efficient Monte-Carlo Bayesian Optimization`
147151 const paper_bibtex = `${ pre } plaintext
@@ -158,7 +162,7 @@ candidate # tensor([0.4887, 0.5063])
158162 < div
159163 className = "productShowcaseSection"
160164 id = "quickstart"
161- style = { { textAlign : 'center' } } >
165+ style = { { textAlign : 'center' } } >
162166 < h2 > Get Started</ h2 >
163167 < Container >
164168 < ol >
@@ -187,7 +191,7 @@ candidate # tensor([0.4887, 0.5063])
187191 ) ;
188192
189193 const Features = ( ) => (
190- < div className = "productShowcaseSection" style = { { textAlign : 'center' } } >
194+ < div className = "productShowcaseSection" style = { { textAlign : 'center' } } >
191195 < h2 > Key Features</ h2 >
192196 < Block layout = "threeColumn" >
193197 { [
@@ -221,7 +225,7 @@ candidate # tensor([0.4887, 0.5063])
221225 < div
222226 className = "productShowcaseSection"
223227 id = "reference"
224- style = { { textAlign : 'center' } } >
228+ style = { { textAlign : 'center' } } >
225229 < h2 > References</ h2 >
226230 < Container >
227231 < a href = { `https://arxiv.org/abs/1910.06403` } > { papertitle } </ a >
0 commit comments