class_docstr: Factorization Machines base class.
code: def __init__(
      self,
      n_factors,
      weight_optimizer,
      latent_optimizer,
      loss,
      sample_normalization,
      l1_weight,
      l2_weight,
      l1_latent,
      l2_latent,
      intercept,
      intercept_lr,
      weight_initializer,
      latent_initializer,
      clip_gradient,
      seed,
  ):
      self.n_factors = n_factors
      self.weight_optimizer = (
          optim.SGD(0.01)
          if weight_optimizer is None
          else weight_optimizer
      )
      self.latent_optimizer = (
          optim.SGD(0.01)
          if latent_optimizer is None
          else latent_optimizer
      )
      self.loss = loss
      self.sample_normalization = sample_normalization
      self.l1_weight = l1_weight
      self.l2_weight = l2_weight
      self.l1_latent = l1_latent
      self.l2_latent = l2_latent
      self.intercept = intercept
  
      self.intercept_lr = (
          optim.schedulers.Constant(intercept_lr)
          if isinstance(intercept_lr, numbers.Number)
          else intercept_lr
      )
  
      if weight_initializer is None:
          weight_initializer = optim.initializers.Zeros()
      self.weight_initializer = weight_initializer
      self.weights = collections.defaultdict(weight_initializer)
  
      if latent_initializer is None:
          latent_initializer = optim.initializers.Normal(
              sigma=0.1, seed=seed
          )
      self.latent_initializer = latent_initializer
      self.latents = self._init_latents()
  
      self.clip_gradient = clip_gradient
      self.seed = seed
  
imports: from __future__ import annotations
  import abc
  import collections
  import numbers
  from collections.abc import Iterable
  import numpy
  from river import optim, utils
label_desc: Use image node_id 1 to create a new BaseFM object  with example: obj = BaseFM(n_factors, weight_optimizer, latent_optimizer, loss, sample_normalization, l1_weight, l2_weight, l1_latent, l2_latent, intercept, intercept_lr, weight_initializer, latent_initializer, clip_gradient, seed)