Github user thunterdb commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12560#discussion_r60616196
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala 
---
    @@ -395,13 +395,21 @@ class ALS(@Since("1.4.0") override val uid: String) 
extends Estimator[ALSModel]
           .map { row =>
             Rating(row.getInt(0), row.getInt(1), row.getFloat(2))
           }
    +    val instr = Instrumentation.create(this, ratings)
    +    instr.logParams(rank, numUserBlocks, numItemBlocks, implicitPrefs, 
alpha,
    +                    userCol, itemCol, ratingCol, predictionCol, maxIter,
    +                    regParam, nonnegative, checkpointInterval, seed)
         val (userFactors, itemFactors) = ALS.train(ratings, rank = $(rank),
           numUserBlocks = $(numUserBlocks), numItemBlocks = $(numItemBlocks),
           maxIter = $(maxIter), regParam = $(regParam), implicitPrefs = 
$(implicitPrefs),
           alpha = $(alpha), nonnegative = $(nonnegative),
           checkpointInterval = $(checkpointInterval), seed = $(seed))
         val userDF = userFactors.toDF("id", "features")
         val itemDF = itemFactors.toDF("id", "features")
    +    val numUserFeatures = userDF.collect.size
    +    val numItemFeatures = itemDF.collect.size
    +    instr.logNumFeatures(numUserFeatures)
    --- End diff --
    
    +1. It seems worth to add a method in the instrumentation that does 
something like that:
    
    ```scala
      def logValue(name: String, num: Long): Unit = {
        log(compact(render(name -> num)))
      }
    ```


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to