zhengruifeng commented on PR #38203: URL: https://github.com/apache/spark/pull/38203#issuecomment-1274301748
take [`RankingMetricsExample`](https://github.com/apache/spark/blob/e3058ba17cb4512537953eb4ded884e24ee93ba2/examples/src/main/scala/org/apache/spark/examples/mllib/RankingMetricsExample.scala) for example: ``` import org.apache.spark.mllib.evaluation.{RankingMetrics, RegressionMetrics} import org.apache.spark.mllib.recommendation.{ALS, Rating} val ratings = spark.read.textFile("data/mllib/sample_movielens_data.txt").rdd.map { line => val fields = line.split("::") Rating(fields(0).toInt, fields(1).toInt, fields(2).toDouble - 2.5) }.cache() // Map ratings to 1 or 0, 1 indicating a movie that should be recommended val binarizedRatings = ratings.map(r => Rating(r.user, r.product, if (r.rating > 0) 1.0 else 0.0)).cache() val numIterations = 1 val rank = 10 val lambda = 0.01 val model = ALS.train(ratings, rank, numIterations, lambda) val userRecommended = model.recommendProductsForUsers(10) userRecommended.count() ``` before:  after:  the shuffle size was reduced from `310.1 KiB` to `110.9 KiB` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
