Skip to content

Commit

Permalink
It's working now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michelangelo D'Agostino committed Oct 2, 2014
1 parent e1fbe5e commit cdd98e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class MatrixFactorizationModel private[mllib] (
scored.top(num)(Ordering.by(_._2))
}

def userFeaturesString(userFeatures: RDD[(Int, Array[Double])]): RDD[String] = {
def userFeaturesString(): RDD[String] = {
userFeatures.map(element => element._1+","+element._2.mkString(","))
}
}
5 changes: 5 additions & 0 deletions python/pyspark/mllib/recommendation.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def predictAll(self, user_product):
return RDD(sc._jvm.PythonRDD.javaToPython(jresult), sc,
AutoBatchedSerializer(PickleSerializer()))

def userFeatures(self):
sc = self._context
juf = self._java_model.userFeaturesString().toJavaRDD()
return RDD(sc._jvm.PythonRDD.javaToPython(juf), sc,
AutoBatchedSerializer(PickleSerializer()))

class ALS(object):

Expand Down

0 comments on commit cdd98e3

Please sign in to comment.