class_docstr: MC-based batch Log Noisy Expected Improvement.
  
  This function does not assume a `best_f` is known (which would require
  noiseless observations). Instead, it uses samples from the joint posterior
  over the `q` test points and previously observed points. A smooth approximation
  to the canonical improvement over previously observed points is computed
  for each sample and the logarithm of the average is returned.
  
  See [Ament2023logei]_ for details. Formally,
  
  `qLogNEI(X) ~ log(qNEI(X)) = Log E(max(max Y - max Y_baseline, 0))`,
  
  where `(Y, Y_baseline) ~ f((X, X_baseline)), X = (x_1,...,x_q)`.
  
  Example:
      >>> model = SingleTaskGP(train_X, train_Y)
      >>> sampler = SobolQMCNormalSampler(1024)
      >>> qLogNEI = qLogNoisyExpectedImprovement(model, train_X, sampler)
      >>> acqval = qLogNEI(test_X)
class_docstr_tok: ["MC-based","batch","Log","Noisy","Expected","Improvement",".","This","function","does","not","assume","a","`","best_f","`","is","known","(","which","would","require","noiseless","observations",")",".","Instead",",","it","uses","samples","from","the","joint","posterior","over","the","`","q","`","test","points","and","previously","observed","points",".","A","smooth","approximation","to","the","canonical","improvement","over","previously","observed","points","is","computed","for","each","sample","and","the","logarithm","of","the","average","is","returned",".","See","[","Ament2023logei","]","_","for","details",".","Formally",",","`","qLogNEI","(","X",")","~","log","(","qNEI","(","X",")",")","=","Log","E","(","max","(","max","Y","-","max","Y_baseline",",","0",")",")","`",",","where","`","(","Y",",","Y_baseline",")","~","f","(","(","X",",","X_baseline",")",")",",","X","=","(","x_1",",","...",",","x_q",")","`",".","Example",":",">",">",">","model","=","SingleTaskGP","(","train_X",",","train_Y",")",">",">",">","sampler","=","SobolQMCNormalSampler","(","1024",")",">",">",">","qLogNEI","=","qLogNoisyExpectedImprovement","(","model",",","train_X",",","sampler",")",">",">",">","acqval","=","qLogNEI","(","test_X",")"]
docstr: q-Noisy Expected Improvement.
  
  Args:
      model: A fitted model.
      X_baseline: A `batch_shape x r x d`-dim Tensor of `r` design points
          that have already been observed. These points are considered as
          the potential best design point.
      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 `batch_shape x m x d`-dim Tensor of `m` design points
          that have 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.
      prune_baseline: If True, remove points in `X_baseline` that are
          highly unlikely to be the best point. This can significantly
          improve performance and is generally recommended. In order to
          customize pruning parameters, instead manually call
          `botorch.acquisition.utils.prune_inferior_points` on `X_baseline`
          before instantiating the acquisition function.
      cache_root: A boolean indicating whether to cache the root
          decomposition over `X_baseline` and use low-rank updates.
      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.
      kwargs: Here for qNEI for compatibility.
  
  TODO: similar to qNEHVI, when we are using sequential greedy candidate
  selection, we could incorporate pending points X_baseline and compute
  the incremental q(Log)NEI from the new point. This would greatly increase
  efficiency for large batches.
docstr_tok: ["q-Noisy","Expected","Improvement",".","Args",":","model",":","A","fitted","model",".","X_baseline",":","A","`","batch_shape","x","r","x","d","`","-dim","Tensor","of","`","r","`","design","points","that","have","already","been","observed",".","These","points","are","considered","as","the","potential","best","design","point",".","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","`","batch_shape","x","m","x","d","`","-dim","Tensor","of","`","m","`","design","points","that","have","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",".","prune_baseline",":","If","True",",","remove","points","in","`","X_baseline","`","that","are","highly","unlikely","to","be","the","best","point",".","This","can","significantly","improve","performance","and","is","generally","recommended",".","In","order","to","customize","pruning","parameters",",","instead","manually","call","`","botorch.acquisition.utils.prune_inferior_points","`","on","`","X_baseline","`","before","instantiating","the","acquisition","function",".","cache_root",":","A","boolean","indicating","whether","to","cache","the","root","decomposition","over","`","X_baseline","`","and","use","low-rank","updates",".","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",".","kwargs",":","Here","for","qNEI","for","compatibility",".","TODO",":","similar","to","qNEHVI",",","when","we","are","using","sequential","greedy","candidate","selection",",","we","could","incorporate","pending","points","X_baseline","and","compute","the","incremental","q","(","Log",")","NEI","from","the","new","point",".","This","would","greatly","increase","efficiency","for","large","batches","."]
code: def __init__(
      self,
      model: Model,
      X_baseline: 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,
      prune_baseline: bool = False,
      cache_root: bool = True,
      tau_max: float = TAU_MAX,
      tau_relu: float = TAU_RELU,
      **kwargs: Any,
  ) -> None:
      r"""q-Noisy Expected Improvement.
  
      Args:
          model: A fitted model.
          X_baseline: A `batch_shape x r x d`-dim Tensor of `r` design points
              that have already been observed. These points are considered as
              the potential best design point.
          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 `batch_shape x m x d`-dim Tensor of `m` design points
              that have 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.
          prune_baseline: If True, remove points in `X_baseline` that are
              highly unlikely to be the best point. This can significantly
              improve performance and is generally recommended. In order to
              customize pruning parameters, instead manually call
              `botorch.acquisition.utils.prune_inferior_points` on `X_baseline`
              before instantiating the acquisition function.
          cache_root: A boolean indicating whether to cache the root
              decomposition over `X_baseline` and use low-rank updates.
          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.
          kwargs: Here for qNEI for compatibility.
  
      TODO: similar to qNEHVI, when we are using sequential greedy candidate
      selection, we could incorporate pending points X_baseline and compute
      the incremental q(Log)NEI from the new point. This would greatly increase
      efficiency for large batches.
      """
      # TODO: separate out baseline variables initialization and other functions
      # in qNEI to avoid duplication of both code and work at runtime.
      super().__init__(
          model=model,
          sampler=sampler,
          objective=objective,
          posterior_transform=posterior_transform,
          X_pending=X_pending,
          constraints=constraints,
          eta=eta,
          fat=fat,
          tau_max=tau_max,
      )
      self.tau_relu = tau_relu
      self._init_baseline(
          model=model,
          X_baseline=X_baseline,
          sampler=sampler,
          objective=objective,
          posterior_transform=posterior_transform,
          prune_baseline=prune_baseline,
          cache_root=cache_root,
          **kwargs,
      )
  
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 qLogNoisyExpectedImprovement object from inherited base classes: LogImprovementMCAcquisitionFunction, CachedCholeskyMCSamplerMixin with example: obj = qLogNoisyExpectedImprovement(model, X_baseline, sampler, objective, posterior_transform, X_pending, constraints, eta, fat, prune_baseline, cache_root, tau_max, tau_relu)