code: def test_ALEBO(self) -> None:
      B = torch.tensor(
          [[1.0, 2.0, 3.0, 4.0, 5.0], [2.0, 3.0, 4.0, 5.0, 6.0]],
          dtype=torch.double,
      )
      m = ALEBO(B=B, laplace_nsamp=5, fit_restarts=1)
      self.assertTrue(torch.equal(B, m.B))
      self.assertEqual(m.laplace_nsamp, 5)
      self.assertEqual(m.fit_restarts, 1)
      self.assertEqual(m.refit_on_update, True)
      self.assertEqual(m.refit_on_cv, False)
      self.assertEqual(m.warm_start_refitting, False)
  
      train_X = torch.tensor(
          [
              [0.0, 0.0, 0.0, 0.0, 0.0],
              [1.0, 1.0, 1.0, 1.0, 1.0],
              [2.0, 2.0, 2.0, 2.0, 2.0],
          ],
          dtype=torch.double,
      )
      train_Y = torch.tensor([[1.0], [2.0], [3.0]], dtype=torch.double)
      train_Yvar = 0.1 * torch.ones(3, 1, dtype=torch.double)
      dataset = SupervisedDataset(
          X=train_X,
          Y=train_Y,
          Yvar=train_Yvar,
          feature_names=[f"x{i}" for i in range(5)],
          outcome_names=["y"],
      )
  
      # Test fit
      m.fit(
          datasets=[dataset, dataset],
          metric_names=["y1", "y2"],
          search_space_digest=SearchSpaceDigest(
              feature_names=[],
              # pyre-fixme[6]: For 2nd param expected `List[Tuple[Union[float,
              #  int], Union[float, int]]]` but got `List[Tuple[int, int]]`.
              bounds=[(-1, 1)] * 5,
          ),
      )
      self.assertIsInstance(m.model, ModelListGP)
      self.assertTrue(torch.allclose(m.Xs[0], (B @ train_X.t()).t()))
  
      # Test predict
      f, cov = m.predict(X=B)
      self.assertEqual(f.shape, torch.Size([2, 2]))
      self.assertEqual(cov.shape, torch.Size([2, 2, 2]))
  
      # Test best point
      objective_weights = torch.tensor([1.0, 0.0], dtype=torch.double)
      search_space_digest = SearchSpaceDigest(
          feature_names=[],
          # pyre-fixme[6]: For 2nd param expected `List[Tuple[Union[float, int],
          #  Union[float, int]]]` but got `List[Tuple[int, int]]`.
          bounds=[(-1, 1)] * 5,
      )
      torch_opt_config = TorchOptConfig(
          objective_weights=objective_weights
      )
      with self.assertRaises(NotImplementedError):
          m.best_point(
              search_space_digest=search_space_digest,
              torch_opt_config=torch_opt_config,
          )
  
      # Test gen
      gen_results = m.gen(
          n=1,
          search_space_digest=search_space_digest,
          torch_opt_config=torch_opt_config,
      )
  
      self.assertFalse(torch.allclose(gen_results.points, train_X))
      self.assertTrue(gen_results.points.min() >= -1)
      self.assertTrue(gen_results.points.max() <= 1)
      # Without
      gen_results = m.gen(
          n=1,
          search_space_digest=search_space_digest,
          torch_opt_config=torch_opt_config,
      )
  
      self.assertEqual(
          gen_results.points.shape,
          torch.Size([1, 5]),
      )
  
      # Test get_and_fit with single metric
      gp = m.get_and_fit_model(
          Xs=[(B @ train_X.t()).t()], Ys=[train_Y], Yvars=[train_Yvar]
      )
      self.assertIsInstance(gp, ALEBOGP)
  
      # Test cross_validate
      f, cov = m.cross_validate(
          datasets=[dataset],
          X_test=train_X,
      )
      self.assertEqual(f.shape, torch.Size([3, 1]))
      self.assertEqual(cov.shape, torch.Size([3, 1, 1]))
      m.refit_on_cv = True
      f, cov = m.cross_validate(
          datasets=[dataset],
          X_test=train_X,
      )
      self.assertEqual(f.shape, torch.Size([3, 1]))
      self.assertEqual(cov.shape, torch.Size([3, 1, 1]))
  
file_path: Ax/ax/models/tests/test_alebo.py
imports: from unittest import mock
  import numpy
  import torch
  from ax.core.search_space import SearchSpaceDigest
  from ax.models.torch.alebo import ALEBO, alebo_acqf_optimizer, ALEBOGP, ALEBOKernel, ei_or_nei, extract_map_statedict, get_batch_model, get_fitted_model, get_map_model
  from ax.models.torch_base import TorchOptConfig
  from ax.utils.common.testutils import TestCase
  from ax.utils.common.typeutils import checked_cast
  from ax.utils.testing.mock import fast_botorch_optimize
  from botorch.acquisition import qLogNoisyExpectedImprovement
  from botorch.acquisition.analytic import ExpectedImprovement
  from botorch.models.model_list_gp_regression import ModelListGP
  from botorch.utils.datasets import SupervisedDataset
  from torch.nn.parameter import Parameter
label_desc: Use image node_id 4 for calling the ALEBOTest obj's underlying member method code with example usage: obj.test_ALEBO() without return types