These methods are available in Spark 1.6 On Tue, Jan 19, 2016 at 12:18 AM, Roberto Pagliari < roberto.pagli...@asos.com> wrote:
> With Spark 1.5, the following code: > > from pyspark import SparkContext, SparkConf > from pyspark.mllib.recommendation import ALS, Rating > 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) > > res = model.recommendProductsForUsers(2) > > raises the error > > > --------------------------------------------------------------------------- > AttributeError Traceback (most recent call > last) > <ipython-input-8-c65e6875ea5b> in <module>() > 7 model = ALS.trainImplicit(ratings, 1, seed=10) > 8 > ----> 9 res = model.recommendProductsForUsers(2) > > AttributeError: 'MatrixFactorizationModel' object has no attribute > ‘recommendProductsForUsers' > > If the method is not available, is there a workaround with a large number > of users and products? >