class_docstr: Higher-Order Factorization Machine base class.
class_docstr_tok: ["Higher-Order","Factorization","Machine","base","class","."]
code: def _calculate_weights_gradients(self, x, g_loss):
      # For notational convenience
      w, l1, l2, sign = (
          self.weights,
          self.l1_weight,
          self.l2_weight,
          utils.math.sign,
      )
  
      return {
          j: g_loss * xj + l1 * sign(w[j]) + l2 * w[j]
          for j, xj in x.items()
      }
  
imports: from __future__ import annotations
  import collections
  import functools
  import itertools
  import numpy
  from river import base, optim, utils
  from .base import BaseFM
label_desc: Use image node_id 7 for calling the HOFM obj's underlying member method code with example usage: obj._calculate_weights_gradients(x, g_loss) and returns: unknown