class_docstr: Biased matrix factorization trained with alternating least squares :cite:p:`Zhou2008-bj`.  This
  is a prediction-oriented algorithm suitable for explicit feedback data, using the alternating
  least squares approach to compute :math:`P` and :math:`Q` to minimize the regularized squared
  reconstruction error of the ratings matrix.
  
  It provides two solvers for the optimization step (the `method` parameter):
  
  ``'cd'`` (the default)
      Coordinate descent :cite:p:`Takacs2011-ix`, adapted for a separately-trained bias model and
      to use weighted regularization as in the original ALS paper :cite:p:`Zhou2008-bj`.
  ``'lu'``
      A direct implementation of the original ALS :cite:p:`Zhou2008-bj` using LU-decomposition
      to solve for the optimized matrices.
  
  See the base class :class:`.MFPredictor` for documentation on
  the estimated parameters you can extract from a trained model.
  
  Args:
      features(int): the number of features to train
      iterations(int): the number of iterations to train
      reg(float): the regularization factor; can also be a tuple ``(ureg, ireg)`` to
          specify separate user and item regularization terms.
      damping(float): damping factor for the underlying bias.
      bias(bool or :class:`Bias`): the bias model.  If ``True``, fits a :class:`Bias` with
          damping ``damping``.
      method(str): the solver to use (see above).
      rng_spec:
          Random number generator or state (see :func:`seedbank.numpy_rng`).
      progress: a :func:`tqdm.tqdm`-compatible progress bar function
docstr: Generator of training iterations.
  
  Args:
      current(PartialModel): the current model step.
      uctx(ndarray): the user-item rating matrix for training user features.
      ictx(ndarray): the item-user rating matrix for training item features.
docstr_tok: ["Generator","of","training","iterations",".","Args",":","current","(","PartialModel",")",":","the","current","model","step",".","uctx","(","ndarray",")",":","the","user-item","rating","matrix","for","training","user","features",".","ictx","(","ndarray",")",":","the","item-user","rating","matrix","for","training","item","features","."]
code: def _train_iters(self, current, uctx, ictx):
      """
      Generator of training iterations.
  
      Args:
          current(PartialModel): the current model step.
          uctx(ndarray): the user-item rating matrix for training user features.
          ictx(ndarray): the item-user rating matrix for training item features.
      """
      n_items = len(current.items)
      n_users = len(current.users)
      assert uctx.nrows == n_users
      assert uctx.ncols == n_items
      assert ictx.nrows == n_items
      assert ictx.ncols == n_users
  
      if self.method == "cd":
          train = _train_matrix_cd
      elif self.method == "lu":
          train = _train_matrix_lu
      else:
          raise ValueError("invalid training method " + self.method)
  
      if isinstance(self.regularization, tuple):
          ureg, ireg = self.regularization
      else:
          ureg = ireg = self.regularization
  
      for epoch in self.progress(
          range(self.iterations), desc="BiasedMF", leave=False
      ):
          du = train(
              uctx, current.user_matrix, current.item_matrix, ureg
          )
          _logger.debug(
              "[%s] finished user epoch %d", self.timer, epoch
          )
          di = train(
              ictx, current.item_matrix, current.user_matrix, ireg
          )
          _logger.debug(
              "[%s] finished item epoch %d", self.timer, epoch
          )
          _logger.info(
              "[%s] finished epoch %d (|ΔP|=%.3f, |ΔQ|=%.3f)",
              self.timer,
              epoch,
              du,
              di,
          )
          yield current
  
imports: import logging
  from collections import namedtuple
  import numpy
  from numba import njit, prange
  from csr import CSR
  from seedbank import numpy_rng
  from .bias import Bias
  from .mf_common import MFPredictor
  from ..data import sparse_ratings
  from ..None import util
  from ..math.solve import _dposv
label_desc: Use image node_id 6 for calling the BiasedMF obj's underlying member method code with example usage: obj._train_iters(current, uctx, ictx) without return types