gpt4 book ai didi

pyspark - 如何确定 Spark 中 ALS.transImplicit 的偏好/置信度?

转载 作者:行者123 更新时间:2023-12-02 03:13:12 36 4
gpt4 key购买 nike

我正在使用 trainsimplicit来自 ALS在 Spark 。
从文档页面:http://spark.apache.org/docs/latest/api/python/pyspark.mllib.html#pyspark.mllib.recommendation.ALS.trainImplicit , 使用 trainImplicit(ratings, rank, iterations=5, lambda_=0.01, blocks=-1, alpha=0.01, nonnegative=False, seed=None)训练模型。

我的问题是我们应该输入 ratings(user, product, view times/watching time >0) ?
(user, product, preference = 0/1) ?

同时,我注意到如果 alpha =0.01更改为其他值,结果会有所不同。我们怎么知道哪个偏好-置信关系,比如c = 1 + alpha * r1+ alpha * log(1+r/e) ( r 可以是持续时间或频率数)在训练期间在 Spark 中使用?

我也注意到,在网上 https://spark.apache.org/docs/1.4.0/api/python/_modules/pyspark/mllib/recommendation.html#ALS.trainImplicit ,还有clstrainsimplicit类方法。这是一种定义偏好-置信关系的方法吗?

非常感谢!

最佳答案

隐含偏好的含义是,每次用户查看/观看产品时,您的信心都会增加。正确的?
因此输入应该是 (user, product, view times/watching time >0)如果您将输入限制为 0/1 偏好,您只会丢失信息。

正如我从 original spark code 看到的

if (implicitPrefs) {
// Extension to the original paper to handle b < 0. confidence is a function of |b|
// instead so that it is never negative. c1 is confidence - 1.0.
val c1 = alpha * math.abs(rating)
// For rating <= 0, the corresponding preference is 0. So the term below is only added
// for rating > 0. Because YtY is already added, we need to adjust the scaling here.
if (rating > 0) {
numExplicits += 1
ls.add(srcFactor, (c1 + 1.0) / c1, c1)
}
}

ALS 使用线性依赖的修改版本。

我从来没有看到任何关于这方面的文件

关于pyspark - 如何确定 Spark 中 ALS.transImplicit 的偏好/置信度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38752606/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com