flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gaborhermann <...@git.apache.org>
Subject [GitHub] flink pull request #2542: [FLINK-4613] [ml] Extend ALS to handle implicit fe...
Date Thu, 29 Sep 2016 11:19:05 GMT
Github user gaborhermann commented on a diff in the pull request:

    --- Diff: flink-libraries/flink-ml/src/main/scala/org/apache/flink/ml/recommendation/ALS.scala
    @@ -581,6 +637,16 @@ object ALS {
             val userXy = new ArrayBuffer[Array[Double]]()
             val numRatings = new ArrayBuffer[Int]()
    +        var precomputedXtX: Array[Double] = null
    +        override def open(config: Configuration): Unit = {
    +          // retrieve broadcasted precomputed XtX if using implicit feedback
    +          if (implicitPrefs) {
    +            precomputedXtX = getRuntimeContext.getBroadcastVariable[Array[Double]]("XtX")
    +              .iterator().next()
    +          }
    +        }
             override def coGroup(left: lang.Iterable[(Int, Int, Array[Array[Double]])],
    --- End diff --
    If I see it right, I did not change this line, it was in the original ALS implementation.
However, I can't find any reason to use the Java `Iterable`.
    There could be other minor things to refactor in the original ALS code, but I preferred
to keep them as they were, not to break anything. Should I refactor some parts along the way
when I extend an algorithm like this?

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message