Apache spark Apache Spark ALS推荐方法
尝试使用Spark MLLib的ALS构建推荐系统 目前,我们正在尝试每天为所有用户预构建建议。我们使用简单的隐式反馈和ALS 问题是,我们有2000万用户和3000万产品,要调用main predict()方法,我们需要用户和产品的笛卡尔连接,这太大了,可能需要几天才能生成连接。有没有一种方法可以避免笛卡尔连接,从而使过程更快 目前我们有8个节点和64Gb的内存,我认为它应该足够的数据Apache spark Apache Spark ALS推荐方法,apache-spark,machine-learning,bigdata,recommendation-engine,apache-spark-mllib,Apache Spark,Machine Learning,Bigdata,Recommendation Engine,Apache Spark Mllib,尝试使用Spark MLLib的ALS构建推荐系统 目前,我们正在尝试每天为所有用户预构建建议。我们使用简单的隐式反馈和ALS 问题是,我们有2000万用户和3000万产品,要调用main predict()方法,我们需要用户和产品的笛卡尔连接,这太大了,可能需要几天才能生成连接。有没有一种方法可以避免笛卡尔连接,从而使过程更快 目前我们有8个节点和64Gb的内存,我认为它应该足够的数据 val users: RDD[Int] = ??? // RDD with 20M us
val users: RDD[Int] = ??? // RDD with 20M userIds
val products: RDD[Int] = ??? // RDD with 30M productIds
val ratings : RDD[Rating] = ??? // RDD with all user->product feedbacks
val model = new ALS().setRank(10).setIterations(10)
.setLambda(0.0001).setImplicitPrefs(true)
.setAlpha(40).run(ratings)
val usersProducts = users.cartesian(products)
val recommendations = model.predict(usersProducts)
不确定您是否真的需要整个20M x 30M矩阵。如果您只想为每个用户的产品预构建建议,可以尝试为所有用户提供
recommendProducts(user:Int,num:Int)
,将自己限制为num
最强烈的建议。还有recommendUsers()
请向我们展示您的代码以便我们提供帮助谢谢,我已经更新了我的初始帖子。