如何在 Spark 中确定 ALS.transImplicit 中的 Preference/Confidence?

How to determine Preference/Confidence in ALS.transImplicit in Spark?

我在 Spark 中使用 ALS 中的 trainsimplicit。 从文档页面: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改为其他值,结果会有所不同。我们如何知道在训练过程中 Spark 使用了哪种偏好-置信关系,如 c = 1 + alpha * r1+ alpha * log(1+r/e)r 可以是持续时间或频率数)?

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

非常感谢!

隐式偏好的含义是,用户每次 views/watches 产品时,您的信心都会增加。正确的? 因此输入应该是 (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 使用线性依赖的修改版本。

虽然我从未见过任何关于此的文档