class_docstr: MC-based batch 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. The improvement
  over previously observed points is computed for each sample and averaged.
  
  `qNEI(X) = 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)
      >>> qNEI = qNoisyExpectedImprovement(model, train_X, sampler)
      >>> qnei = qNEI(test_X)
class_docstr_tok: ["MC-based","batch","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",".","The","improvement","over","previously","observed","points","is","computed","for","each","sample","and","averaged",".","`","qNEI","(","X",")","=","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",")",">",">",">","qNEI","=","qNoisyExpectedImprovement","(","model",",","train_X",",","sampler",")",">",">",">","qnei","=","qNEI","(","test_X",")"]
docstr: Computes best feasible objective value from samples.
  
  Args:
      samples: `sample_shape x batch_shape x q x m`-dim posterior samples.
      obj: A `sample_shape x batch_shape x q`-dim Tensor of MC objective values.
  
  Returns:
      A `sample_shape x batch_shape x 1`-dim Tensor of best feasible objectives.
docstr_tok: ["Computes","best","feasible","objective","value","from","samples",".","Args",":","samples",":","`","sample_shape","x","batch_shape","x","q","x","m","`","-dim","posterior","samples",".","obj",":","A","`","sample_shape","x","batch_shape","x","q","`","-dim","Tensor","of","MC","objective","values",".","Returns",":","A","`","sample_shape","x","batch_shape","x","1","`","-dim","Tensor","of","best","feasible","objectives","."]
code: def _compute_best_feasible_objective(
      self, samples: Tensor, obj: Tensor
  ) -> Tensor:
      r"""Computes best feasible objective value from samples.
  
      Args:
          samples: `sample_shape x batch_shape x q x m`-dim posterior samples.
          obj: A `sample_shape x batch_shape x q`-dim Tensor of MC objective values.
  
      Returns:
          A `sample_shape x batch_shape x 1`-dim Tensor of best feasible objectives.
      """
      return compute_best_feasible_objective(
          samples=samples,
          obj=obj,
          constraints=self._constraints,
          model=self.model,
          objective=self.objective,
          posterior_transform=self.posterior_transform,
          X_baseline=self.X_baseline,
      )
  
imports: from __future__ import annotations
  import math
  from abc import ABC, abstractmethod
  from copy import deepcopy
  from functools import partial
  from typing import Callable, List, Optional, Protocol, Tuple, Union
  import torch
  from botorch.acquisition.acquisition import AcquisitionFunction, MCSamplerMixin
  from botorch.acquisition.cached_cholesky import CachedCholeskyMCSamplerMixin
  from botorch.acquisition.objective import ConstrainedMCObjective, IdentityMCObjective, MCAcquisitionObjective, PosteriorTransform
  from botorch.acquisition.utils import compute_best_feasible_objective, prune_inferior_points, repeat_to_match_aug_dim
  from botorch.exceptions.errors import UnsupportedError
  from botorch.models.model import Model
  from botorch.sampling.base import MCSampler
  from botorch.utils.objective import compute_smoothed_feasibility_indicator
  from botorch.utils.transforms import concatenate_pending_points, match_batch_shape, t_batch_mode_transform
  from torch import Tensor
label_desc: Use image node_id 5 for calling the qNoisyExpectedImprovement obj's underlying member method code with example usage: obj._compute_best_feasible_objective(samples, obj) and returns: compute_best_feasible_objective