Skip to content

Commit

Permalink
Added unit tests for userFeatures and productFeatures and merged master.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michelangelo D'Agostino committed Oct 21, 2014
1 parent d5eadf8 commit c98f9e2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions python/pyspark/mllib/recommendation.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ class MatrixFactorizationModel(object):
>>> model = ALS.train(ratings, 1)
>>> model.predictAll(testset).count() == 2
True
>>> model = ALS.train(ratings, 4)
>>> model.userFeatures().count() == 2
True
>>> first_user = model.userFeatures().take(1)[0]
>>> latents = first_user[1]
>>> len(latents) == 4
True
>>> model.productFeatures().count() == 2
True
>>> first_product = model.productFeatures().take(1)[0]
>>> latents = first_product[1]
>>> len(latents) == 4
True
"""

def __init__(self, sc, java_model):
Expand Down

0 comments on commit c98f9e2

Please sign in to comment.