Github user thunterdb commented on the pull request:

    https://github.com/apache/spark/pull/12560#issuecomment-214890157
  
    @wangmiao1981 sorry for the delay. I agree with @MLnick that the developer 
API of ALS is already brittle enough as it stands. One way to still do it is to 
add one layer of indirection:
    
    ```scala
      private def train0[ID: ClassTag](
          ratings: RDD[Rating[ID]],
          rank: Int,
          numUserBlocks: Int,
          numItemBlocks: Int,
          maxIter: Int,
          regParam: Double,
          implicitPrefs: Boolean,
          alpha: Double,
          nonnegative: Boolean,
          checkpointInterval: Int,
          seed: Long,
          instrumentation: Instrumentation[ALS])(
          implicit ord: Ordering[ID]) = (RDD[(ID, Array[Float])], RDD[(ID, 
Array[Float])]) = { // all the code here}
    
      @DeveloperApi
      def train[ID: ClassTag]( // scalastyle:ignore
          ratings: RDD[Rating[ID]],
          rank: Int = 10,
          numUserBlocks: Int = 10,
          numItemBlocks: Int = 10,
          maxIter: Int = 10,
          regParam: Double = 1.0,
          implicitPrefs: Boolean = false,
          alpha: Double = 1.0,
          nonnegative: Boolean = false,
          intermediateRDDStorageLevel: StorageLevel = 
StorageLevel.MEMORY_AND_DISK,
          finalRDDStorageLevel: StorageLevel = StorageLevel.MEMORY_AND_DISK,
          checkpointInterval: Int = 10,
          seed: Long = 0L)(
          implicit ord: Ordering[ID]): (RDD[(ID, Array[Float])], RDD[(ID, 
Array[Float])]) = train0(
            ratings = ratings, 
            ...)
    ```
    
    This minimizes the changes and keeps the API binary compatible, however it 
is not pretty. @MLnick @yanboliang  what do you think? I do not have a strong 
opinion on this one.


---
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