class_docstr: Alternating Least Squares
  
  A Recommendation Model based off the algorithms described in the paper 'Collaborative
  Filtering for Implicit Feedback Datasets' with performance optimizations described in
  'Applications of the Conjugate Gradient Method for Implicit Feedback Collaborative
  Filtering.'
  
  Parameters
  ----------
  factors : int, optional
      The number of latent factors to compute
  regularization : float, optional
      The regularization factor to use
  alpha : float, optional
      The weight to give to positive examples.
  dtype : data-type, optional
      Specifies whether to generate 64 bit or 32 bit floating point factors
  use_native : bool, optional
      Use native extensions to speed up model fitting
  use_cg : bool, optional
      Use a faster Conjugate Gradient solver to calculate factors
  iterations : int, optional
      The number of ALS iterations to use when fitting data
  calculate_training_loss : bool, optional
      Whether to log out the training loss at each iteration
  num_threads : int, optional
      The number of threads to use for fitting the model and batch recommend calls.
      Specifying 0 means to default to the number of cores on the machine.
  random_state : int, numpy.random.RandomState, np.random.Generator or None, optional
      The random state for seeding the initial item and user factors.
      Default is None.
  
  Attributes
  ----------
  item_factors : ndarray
      Array of latent factors for each item in the training set
  user_factors : ndarray
      Array of latent factors for each user in the training set
code: def save(self, fileobj_or_path):
      args = {
          "user_factors": self.user_factors,
          "item_factors": self.item_factors,
          "regularization": self.regularization,
          "factors": self.factors,
          "num_threads": self.num_threads,
          "iterations": self.iterations,
          "use_native": self.use_native,
          "use_cg": self.use_cg,
          "cg_steps": self.cg_steps,
          "calculate_training_loss": self.calculate_training_loss,
          "dtype": self.dtype.name,
          "random_state": self.random_state,
          "alpha": self.alpha,
      }
      # filter out 'None' valued args, since we can't go np.load on
      # them without using pickle
      args = {k: v for k, v in args.items() if v is not None}
      np.savez(fileobj_or_path, **args)
  
imports: import functools
  import heapq
  import logging
  import time
  import numpy
  import scipy
  import scipy.sparse
  from tqdm.auto import tqdm
  from ..utils import check_blas_config, check_csr, check_random_state, nonzeros
  from .None import _als
  from .matrix_factorization_base import MatrixFactorizationBase
label_desc: Use image node_id 12 for calling the AlternatingLeastSquares obj's underlying member method code with example usage: obj.save(fileobj_or_path) without return types