class_docstr: MC-based batch Log Expected Improvement.
  
  This computes qLogEI by
  (1) sampling the joint posterior over q points,
  (2) evaluating the smoothed log improvement over the current best for each sample,
  (3) smoothly maximizing over q, and
  (4) averaging over the samples in log space.
  
  See [Ament2023logei]_ for details. Formally,
  
  `qLogEI(X) ~ log(qEI(X)) = log(E(max(max Y - best_f, 0)))`.
  
  where `Y ~ f(X)`, and `X = (x_1,...,x_q)`, .
  
  Example:
      >>> model = SingleTaskGP(train_X, train_Y)
      >>> best_f = train_Y.max()[0]
      >>> sampler = SobolQMCNormalSampler(1024)
      >>> qLogEI = qLogExpectedImprovement(model, best_f, sampler)
      >>> qei = qLogEI(test_X)
class_docstr_tok: ["MC-based","batch","Log","Expected","Improvement",".","This","computes","qLogEI","by","(","1",")","sampling","the","joint","posterior","over","q","points",",","(","2",")","evaluating","the","smoothed","log","improvement","over","the","current","best","for","each","sample",",","(","3",")","smoothly","maximizing","over","q",",","and","(","4",")","averaging","over","the","samples","in","log","space",".","See","[","Ament2023logei","]","_","for","details",".","Formally",",","`","qLogEI","(","X",")","~","log","(","qEI","(","X",")",")","=","log","(","E","(","max","(","max","Y","-","best_f",",","0",")",")",")","`",".","where","`","Y","~","f","(","X",")","`",",","and","`","X","=","(","x_1",",","...",",","x_q",")","`",",",".","Example",":",">",">",">","model","=","SingleTaskGP","(","train_X",",","train_Y",")",">",">",">","best_f","=","train_Y.max","(",")","[","0","]",">",">",">","sampler","=","SobolQMCNormalSampler","(","1024",")",">",">",">","qLogEI","=","qLogExpectedImprovement","(","model",",","best_f",",","sampler",")",">",">",">","qei","=","qLogEI","(","test_X",")"]
docstr: q-Log Expected Improvement.
  
  Args:
      model: A fitted model.
      best_f: The best objective value observed so far (assumed noiseless). Can be
          a `batch_shape`-shaped tensor, which in case of a batched model
          specifies potentially different values for each element of the batch.
      sampler: The sampler used to draw base samples. See `MCAcquisitionFunction`
          more details.
      objective: The MCAcquisitionObjective under which the samples are evaluated.
          Defaults to `IdentityMCObjective()`.
      posterior_transform: A PosteriorTransform (optional).
      X_pending:  A `m x d`-dim Tensor of `m` design points that have been
          submitted for function evaluation but have not yet been evaluated.
          Concatenated into `X` upon forward call. Copied and set to have no
          gradient.
      constraints: A list of constraint callables which map a Tensor of posterior
          samples of dimension `sample_shape x batch-shape x q x m`-dim to a
          `sample_shape x batch-shape x q`-dim Tensor. The associated constraints
          are satisfied if `constraint(samples) < 0`.
      eta: Temperature parameter(s) governing the smoothness of the sigmoid
          approximation to the constraint indicators. See the docs of
          `compute_(log_)smoothed_constraint_indicator` for details.
      fat: Toggles the logarithmic / linear asymptotic behavior of the smooth
          approximation to the ReLU.
      tau_max: Temperature parameter controlling the sharpness of the smooth
          approximations to max.
      tau_relu: Temperature parameter controlling the sharpness of the smooth
          approximations to ReLU.
docstr_tok: ["q-Log","Expected","Improvement",".","Args",":","model",":","A","fitted","model",".","best_f",":","The","best","objective","value","observed","so","far","(","assumed","noiseless",")",".","Can","be","a","`","batch_shape","`","-shaped","tensor",",","which","in","case","of","a","batched","model","specifies","potentially","different","values","for","each","element","of","the","batch",".","sampler",":","The","sampler","used","to","draw","base","samples",".","See","`","MCAcquisitionFunction","`","more","details",".","objective",":","The","MCAcquisitionObjective","under","which","the","samples","are","evaluated",".","Defaults","to","`","IdentityMCObjective","(",")","`",".","posterior_transform",":","A","PosteriorTransform","(","optional",")",".","X_pending",":","A","`","m","x","d","`","-dim","Tensor","of","`","m","`","design","points","that","have","been","submitted","for","function","evaluation","but","have","not","yet","been","evaluated",".","Concatenated","into","`","X","`","upon","forward","call",".","Copied","and","set","to","have","no","gradient",".","constraints",":","A","list","of","constraint","callables","which","map","a","Tensor","of","posterior","samples","of","dimension","`","sample_shape","x","batch-shape","x","q","x","m","`","-dim","to","a","`","sample_shape","x","batch-shape","x","q","`","-dim","Tensor",".","The","associated","constraints","are","satisfied","if","`","constraint","(","samples",")","<","0","`",".","eta",":","Temperature","parameter","(","s",")","governing","the","smoothness","of","the","sigmoid","approximation","to","the","constraint","indicators",".","See","the","docs","of","`","compute_","(","log_",")","smoothed_constraint_indicator","`","for","details",".","fat",":","Toggles","the","logarithmic","\/","linear","asymptotic","behavior","of","the","smooth","approximation","to","the","ReLU",".","tau_max",":","Temperature","parameter","controlling","the","sharpness","of","the","smooth","approximations","to","max",".","tau_relu",":","Temperature","parameter","controlling","the","sharpness","of","the","smooth","approximations","to","ReLU","."]
code: def __init__(
      self,
      model: Model,
      best_f: Union[float, Tensor],
      sampler: Optional[MCSampler] = None,
      objective: Optional[MCAcquisitionObjective] = None,
      posterior_transform: Optional[PosteriorTransform] = None,
      X_pending: Optional[Tensor] = None,
      constraints: Optional[List[Callable[[Tensor], Tensor]]] = None,
      eta: Union[Tensor, float] = 1e-3,
      fat: bool = True,
      tau_max: float = TAU_MAX,
      tau_relu: float = TAU_RELU,
  ) -> None:
      r"""q-Log Expected Improvement.
  
      Args:
          model: A fitted model.
          best_f: The best objective value observed so far (assumed noiseless). Can be
              a `batch_shape`-shaped tensor, which in case of a batched model
              specifies potentially different values for each element of the batch.
          sampler: The sampler used to draw base samples. See `MCAcquisitionFunction`
              more details.
          objective: The MCAcquisitionObjective under which the samples are evaluated.
              Defaults to `IdentityMCObjective()`.
          posterior_transform: A PosteriorTransform (optional).
          X_pending:  A `m x d`-dim Tensor of `m` design points that have been
              submitted for function evaluation but have not yet been evaluated.
              Concatenated into `X` upon forward call. Copied and set to have no
              gradient.
          constraints: A list of constraint callables which map a Tensor of posterior
              samples of dimension `sample_shape x batch-shape x q x m`-dim to a
              `sample_shape x batch-shape x q`-dim Tensor. The associated constraints
              are satisfied if `constraint(samples) < 0`.
          eta: Temperature parameter(s) governing the smoothness of the sigmoid
              approximation to the constraint indicators. See the docs of
              `compute_(log_)smoothed_constraint_indicator` for details.
          fat: Toggles the logarithmic / linear asymptotic behavior of the smooth
              approximation to the ReLU.
          tau_max: Temperature parameter controlling the sharpness of the smooth
              approximations to max.
          tau_relu: Temperature parameter controlling the sharpness of the smooth
              approximations to ReLU.
      """
      super().__init__(
          model=model,
          sampler=sampler,
          objective=objective,
          posterior_transform=posterior_transform,
          X_pending=X_pending,
          constraints=constraints,
          eta=eta,
          tau_max=check_tau(tau_max, name="tau_max"),
          fat=fat,
      )
      self.register_buffer("best_f", torch.as_tensor(best_f))
      self.tau_relu = check_tau(tau_relu, name="tau_relu")
  
imports: from __future__ import annotations
  from copy import deepcopy
  from functools import partial
  from typing import Any, Callable, List, Optional, Tuple, TypeVar, Union
  import torch
  from botorch.acquisition.cached_cholesky import CachedCholeskyMCSamplerMixin
  from botorch.acquisition.monte_carlo import SampleReducingMCAcquisitionFunction
  from botorch.acquisition.objective import ConstrainedMCObjective, MCAcquisitionObjective, PosteriorTransform
  from botorch.acquisition.utils import compute_best_feasible_objective, prune_inferior_points
  from botorch.exceptions.errors import BotorchError
  from botorch.models.model import Model
  from botorch.sampling.base import MCSampler
  from botorch.utils.safe_math import fatmax, log_fatplus, log_softplus, logmeanexp, smooth_amax
  from botorch.utils.transforms import match_batch_shape
  from torch import Tensor
label_desc: Use image node_id 1 to create a new qLogExpectedImprovement object from inherited base classes: LogImprovementMCAcquisitionFunction with example: obj = qLogExpectedImprovement(model, best_f, sampler, objective, posterior_transform, X_pending, constraints, eta, fat, tau_max, tau_relu)