class_docstr: Sample from a set of points according to their max posterior value.
  
  Example:
      >>> MPS = MaxPosteriorSampling(model)  # model w/ feature dim d=3
      >>> X = torch.rand(2, 100, 3)
      >>> sampled_X = MPS(X, num_samples=5)
docstr: Constructor for the SamplingStrategy base class.
  
  Args:
      model: A fitted model.
      objective: The MCAcquisitionObjective under which the samples are
          evaluated. Defaults to `IdentityMCObjective()`.
      posterior_transform: An optional PosteriorTransform.
      replacement: If True, sample with replacement.
docstr_tok: ["Constructor","for","the","SamplingStrategy","base","class",".","Args",":","model",":","A","fitted","model",".","objective",":","The","MCAcquisitionObjective","under","which","the","samples","are","evaluated",".","Defaults","to","`","IdentityMCObjective","(",")","`",".","posterior_transform",":","An","optional","PosteriorTransform",".","replacement",":","If","True",",","sample","with","replacement","."]
code: def __init__(
      self,
      model: Model,
      objective: Optional[MCAcquisitionObjective] = None,
      posterior_transform: Optional[PosteriorTransform] = None,
      replacement: bool = True,
  ) -> None:
      r"""Constructor for the SamplingStrategy base class.
  
      Args:
          model: A fitted model.
          objective: The MCAcquisitionObjective under which the samples are
              evaluated. Defaults to `IdentityMCObjective()`.
          posterior_transform: An optional PosteriorTransform.
          replacement: If True, sample with replacement.
      """
      super().__init__()
      self.model = model
      self.objective = (
          IdentityMCObjective() if objective is None else objective
      )
      self.posterior_transform = posterior_transform
      self.replacement = replacement
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from typing import Any, Optional, Union
  import torch
  from botorch.acquisition.acquisition import AcquisitionFunction
  from botorch.acquisition.objective import IdentityMCObjective, MCAcquisitionObjective, PosteriorTransform
  from botorch.generation.utils import _flip_sub_unique
  from botorch.models.model import Model
  from botorch.models.model_list_gp_regression import ModelListGP
  from botorch.models.multitask import MultiTaskGP
  from botorch.utils.sampling import batched_multinomial
  from botorch.utils.transforms import standardize
  from torch import Tensor
  from torch.nn import Module
label_desc: Use image node_id 1 to create a new MaxPosteriorSampling object from inherited base classes: SamplingStrategy with example: obj = MaxPosteriorSampling(model, objective, posterior_transform, replacement)