class_docstr: Adam optimizer.
  
  Parameters
  ----------
  lr
  beta_1
  beta_2
  eps
  
  Attributes
  ----------
  m : collections.defaultdict
  v : collections.defaultdict
  
  Examples
  --------
  
  >>> from river import datasets
  >>> from river import evaluate
  >>> from river import linear_model
  >>> from river import metrics
  >>> from river import optim
  >>> from river import preprocessing
  
  >>> dataset = datasets.Phishing()
  >>> optimizer = optim.Adam()
  >>> model = (
  ...     preprocessing.StandardScaler() |
  ...     linear_model.LogisticRegression(optimizer)
  ... )
  >>> metric = metrics.F1()
  
  >>> evaluate.progressive_val_score(dataset, model, metric)
  F1: 86.52%
  
  References
  ----------
  [^1]: [Kingma, D.P. and Ba, J., 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.](https://arxiv.org/pdf/1412.6980.pdf)
code: def _step_with_vector(self, w, g):
      if self.m is None:
          if isinstance(w, np.ndarray):
              self.m = np.zeros_like(w)
              self.v = np.zeros_like(w)
          else:
              self.m = utils.VectorDict()
              self.v = utils.VectorDict()
  
      lr = (
          self.learning_rate
          * (1 - self.beta_2 ** (self.n_iterations + 1)) ** 0.5
      )
      lr /= 1 - self.beta_1 ** (self.n_iterations + 1)
  
      self.m = self.beta_1 * self.m + (1 - self.beta_1) * g
      self.v = self.beta_2 * self.v + (1 - self.beta_2) * g**2
      w -= lr * self.m / (self.v**0.5 + self.eps)
  
      return w
  
file_path: river/river/optim/adam.py
imports: from __future__ import annotations
  import collections
  import numpy
  from river import optim, utils
label_desc: Use image node_id 3 for calling the Adam obj's underlying member method code with example usage: obj._step_with_vector(w, g) and returns: w