我有MatrixFactorizationModel对象。如果我试图在通过ALS.train(...)构建模型后立即向单个用户推荐产品然后它需要300ms (对于我的数据和硬件)。但如果我将模型保存到磁盘并加载回来,那么推荐几乎需要2000ms。斯帕克还警告说:
15/07/17 11:05:47 WARN MatrixFactorizationModel: User factor does not have a partitioner. Prediction on individual records could be slow.
15/07/17 11:05:47 WARN MatrixFactorizationModel: User factor is not cached. Prediction could be slow.
15/07/17 11:05:47 WARN MatrixFactorizationModel: Product factor does not have a partitioner. Prediction on individual records could be slow.
15/07/17 11:05:47 WARN MatrixFactorizationModel: Product factor is not cached. Prediction could be slow.如何在加载模型后创建/设置分区程序并缓存用户和产品因子?以下方法无济于事:
model.userFeatures().cache();
model.productFeatures().cache();此外,我还试图对这些rdds进行重新分区,并从重新分区的版本中创建新模型,但这也没有帮助。
发布于 2016-08-01 18:09:19
你不必使用括号,userFeatures是(Int,ArrayDouble)的RDD,它不带参数。
这将对您有所帮助:
model.userFeatures.cache
model.productFeatures.cachehttps://stackoverflow.com/questions/31479240
复制相似问题