class_docstr: A matrix factorisation model trained by regularized alternating
  least-squares.
  
  .. versionadded:: 0.9.0
  
  Examples
  --------
  >>> r1 = (1, 1, 1.0)
  >>> r2 = (1, 2, 2.0)
  >>> r3 = (2, 1, 2.0)
  >>> ratings = sc.parallelize([r1, r2, r3])
  >>> model = ALS.trainImplicit(ratings, 1, seed=10)
  >>> model.predict(2, 2)
  0.4...
  
  >>> testset = sc.parallelize([(1, 2), (1, 1)])
  >>> model = ALS.train(ratings, 2, seed=0)
  >>> model.predictAll(testset).collect()
  [Rating(user=1, product=1, rating=1.0...), Rating(user=1, product=2, rating=1.9...)]
  
  >>> model = ALS.train(ratings, 4, seed=10)
  >>> model.userFeatures().collect()
  [(1, array('d', [...])), (2, array('d', [...]))]
  
  >>> model.recommendUsers(1, 2)
  [Rating(user=2, product=1, rating=1.9...), Rating(user=1, product=1, rating=1.0...)]
  >>> model.recommendProducts(1, 2)
  [Rating(user=1, product=2, rating=1.9...), Rating(user=1, product=1, rating=1.0...)]
  >>> model.rank
  4
  
  >>> first_user = model.userFeatures().take(1)[0]
  >>> latents = first_user[1]
  >>> len(latents)
  4
  
  >>> model.productFeatures().collect()
  [(1, array('d', [...])), (2, array('d', [...]))]
  
  >>> first_product = model.productFeatures().take(1)[0]
  >>> latents = first_product[1]
  >>> len(latents)
  4
  
  >>> products_for_users = model.recommendProductsForUsers(1).collect()
  >>> len(products_for_users)
  2
  >>> products_for_users[0]
  (1, (Rating(user=1, product=2, rating=...),))
  
  >>> users_for_products = model.recommendUsersForProducts(1).collect()
  >>> len(users_for_products)
  2
  >>> users_for_products[0]
  (1, (Rating(user=2, product=1, rating=...),))
  
  >>> model = ALS.train(ratings, 1, nonnegative=True, seed=123456789)
  >>> model.predict(2, 2)
  3.73...
  
  >>> df = sqlContext.createDataFrame([Rating(1, 1, 1.0), Rating(1, 2, 2.0), Rating(2, 1, 2.0)])
  >>> model = ALS.train(df, 1, nonnegative=True, seed=123456789)
  >>> model.predict(2, 2)
  3.73...
  
  >>> model = ALS.trainImplicit(ratings, 1, nonnegative=True, seed=123456789)
  >>> model.predict(2, 2)
  0.4...
  
  >>> import os, tempfile
  >>> path = tempfile.mkdtemp()
  >>> model.save(sc, path)
  >>> sameModel = MatrixFactorizationModel.load(sc, path)
  >>> sameModel.predict(2, 2)
  0.4...
  >>> sameModel.predictAll(testset).collect()
  [Rating(...
  >>> from shutil import rmtree
  >>> try:
  ...     rmtree(path)
  ... except OSError:
  ...     pass
docstr: Predicts rating for the given user and product.
docstr_tok: ["Predicts","rating","for","the","given","user","and","product","."]
code: def predict(self, user: int, product: int) -> float:
      """
      Predicts rating for the given user and product.
      """
      return self._java_model.predict(int(user), int(product))
  
imports: import array
  import sys
  from typing import Any, List, NamedTuple, Optional, Tuple, Type, Union
  from pyspark import SparkContext, since
  from pyspark.rdd import RDD
  from pyspark.mllib.common import JavaModelWrapper, callMLlibFunc, inherit_doc
  from pyspark.mllib.util import JavaLoader, JavaSaveable
  from pyspark.sql import DataFrame
label_desc: Use image node_id 1 for calling the MatrixFactorizationModel obj's underlying member method code with example usage: obj.predict(user, product) and returns: self