class_docstr: Optimizer interface.
  
  Every optimizer inherits from this base interface.
  
  Parameters
  ----------
  lr
  
  Attributes
  ----------
  learning_rate : float
      Returns the current learning rate value.
docstr: Updates a weight vector given a gradient.
  
  Parameters
  ----------
  w
      A vector-like object containing weights. The weights are modified in-place.
  g
      A vector-like object of gradients.
  
  Returns
  -------
  The updated weights.
docstr_tok: ["Updates","a","weight","vector","given","a","gradient",".","Parameters","--","--","--","--","--","w","A","vector-like","object","containing","weights",".","The","weights","are","modified","in-place",".","g","A","vector-like","object","of","gradients",".","Returns","--","--","--","-","The","updated","weights","."]
code: def step(self, w: dict | VectorLike, g: dict | VectorLike) -> dict | VectorLike:  # type: ignore
      """Updates a weight vector given a gradient.
  
      Parameters
      ----------
      w
          A vector-like object containing weights. The weights are modified in-place.
      g
          A vector-like object of gradients.
  
      Returns
      -------
      The updated weights.
  
      """
  
      if (
          isinstance(w, utils.VectorDict) or isinstance(w, np.ndarray)
      ) and (
          isinstance(g, utils.VectorDict) or isinstance(g, np.ndarray)
      ):
          try:
              w = self._step_with_vector(w, g)
              self.n_iterations += 1
              return w
          except NotImplementedError:
              pass
  
      w = self._step_with_dict(w, g)
      self.n_iterations += 1
      return w
  
imports: from __future__ import annotations
  import abc
  import typing
  import numpy
  from river import base, optim, utils
label_desc: Use image node_id 7 for calling the Optimizer obj's underlying member method code with example usage: obj.step(w, g) and returns: w, w