class_docstr: Exponential moving average stopping criterion.
  
  Computes an exponentially weighted moving average over window length `n_window`
  and checks whether the relative decrease in this moving average between steps
  is less than a provided tolerance level. That is, in iteration `i`, it computes
  
      v[i,j] := fvals[i - n_window + j] * w[j]
  
  for all `j = 0, ..., n_window`, where `w[j] = exp(-eta * (1 - j / n_window))`.
  Letting `ma[i] := sum_j(v[i,j])`, the criterion evaluates to `True` whenever
  
      (ma[i-1] - ma[i]) / abs(ma[i-1]) < rel_tol (if minimize=True)
      (ma[i] - ma[i-1]) / abs(ma[i-1]) < rel_tol (if minimize=False)
docstr: Exponential moving average stopping criterion.
  
  Args:
      maxiter: Maximum number of iterations.
      minimize: If True, assume minimization.
      n_window: The size of the exponential moving average window.
      eta: The exponential decay factor in the weights.
      rel_tol: Relative tolerance for termination.
code: def __init__(
      self,
      maxiter: int = 10000,
      minimize: bool = True,
      n_window: int = 10,
      eta: float = 1.0,
      rel_tol: float = 1e-5,
  ) -> None:
      r"""Exponential moving average stopping criterion.
  
      Args:
          maxiter: Maximum number of iterations.
          minimize: If True, assume minimization.
          n_window: The size of the exponential moving average window.
          eta: The exponential decay factor in the weights.
          rel_tol: Relative tolerance for termination.
      """
      self.maxiter = maxiter
      self.minimize = minimize
      self.n_window = n_window
      self.rel_tol = rel_tol
      self.iter = 0
      weights = torch.exp(torch.linspace(-eta, 0, self.n_window))
      self.weights = weights / weights.sum()
      self._prev_fvals = None
  
file_path: botorch/botorch/optim/stopping.py
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  import torch
  from torch import Tensor
label_desc: Use image node_id 1 to create a new ExpMAStoppingCriterion object from inherited base classes: StoppingCriterion with example: obj = ExpMAStoppingCriterion(maxiter, minimize, n_window, eta, rel_tol)