Why recommendProductsForUsers is not a member of org.apache.spark.mllib.recommendation.MatrixFactorizationModel

南楼画角 提交于 2019-12-23 06:29:55

问题


i have build recommendations system using Spark with ALS collaboratife filtering mllib

my snippet code :

bestModel.get
 .predict(toBePredictedBroadcasted.value)

evrything is ok, but i need change code for fullfilment requirement, i read from scala doc in here

i need to use def recommendProducts

but when i tried in my code :

bestModel.get.recommendProductsForUsers(100)

and error when compile :

value recommendProductsForUsers is not a member of org.apache.spark.mllib.recommendation.MatrixFactorizationModel
[error]     bestModel.get.recommendProductsForUsers(100)

maybe anyone can help me

thx

NB : i use Spark 1.5.0

my import :

import com.datastax.spark.connector._
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.SparkContext._
import java.io.File
import scala.io.Source
import org.apache.log4j.Logger
import org.apache.log4j.Level
import org.apache.spark.rdd._
import org.apache.spark.mllib.recommendation.{ALS, Rating, MatrixFactorizationModel}
import org.apache.spark.sql.SQLContext
import org.apache.spark.broadcast.Broadcast

来源:https://stackoverflow.com/questions/33646889/why-recommendproductsforusers-is-not-a-member-of-org-apache-spark-mllib-recommen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!