Package pyspark :: Package mllib :: Module recommendation :: Class MatrixFactorizationModel
[frames] | no frames]

Class MatrixFactorizationModel

source code

object --+
         |
        MatrixFactorizationModel

A matrix factorisation model trained by regularized alternating least-squares.

>>> 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)
>>> model.predict(2,2) is not None
True
>>> testset = sc.parallelize([(1, 2), (1, 1)])
>>> model.predictAll(testset).count() == 2
True
Instance Methods
 
__init__(self, sc, java_model)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__del__(self) source code
 
predict(self, user, product) source code
 
predictAll(self, usersProducts) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, sc, java_model)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)