GitHub PullRequestReviewCommentEvent at 2014-04-29 06:19:21
Repository: spark
Actor: mengxr
Payload: {"comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/12080856","id":12080856,"diff_hunk":"@@ -708,6 +709,123 @@ object ALS {\n     trainImplicit(ratings, rank, iterations, 0.01, -1, 1.0)\n   }\n \n+  @DeveloperApi\n+  case class IterationCost(inboundBytes: Double, computation: Double, outboundBytes: Double)\n+\n+  /**\n+   * :: DeveloperApi ::\n+   * Given an RDD of ratings, a rank, and two partitioners, compute rough estimates of the\n+   * computation time and communication cost of one iteration of ALS.  Returns a pair of pairs of\n+   * Maps.  The first pair of maps represents computation time in unspecified units.  The second\n+   * pair of maps represents communication cost in uncompressed bytes.  The first element of each\n+   * pair is the cost attributable to user partitioning, while the second is the cost attributable\n+   * to product partitioning.\n+   *\n+   * @param ratings             RDD of Rating objects\n+   * @param rank                number of features to use\n+   * @param userPartitioner     partitioner for partitioning users\n+   * @param productPartitioner  partitioner for partitioning products\n+   */\n+  @DeveloperApi\n+  def estimateCost(ratings: RDD[Rating], rank: Int, userPartitioner: Partitioner,\n+      productPartitioner: Partitioner):\n+      (Map[Int, IterationCost], Map[Int, IterationCost]) = {\n+    // user partition -> set of products\n+    val utalk = ratings.mapPartitions(x => {","path":"mllib/src/main/scala/org/apache/spark/mllib/recommendation/ALS.scala","position":null,"original_position":43,"commit_id":"2ab7a5d0d5c46def977ad2163a630f4e107659d5","original_commit_id":"8b21e6d98bc4d7b32d8a32cd191d8846b1268106","user":{"login":"mengxr","id":829644,"avatar_url":"https://avatars.githubusercontent.com/u/829644?","gravatar_id":"0e16fce91950d1b5a312649751ff1b14","url":"https://api.github.com/users/mengxr","html_url":"https://github.com/mengxr","followers_url":"https://api.github.com/users/mengxr/followers","following_url":"https://api.github.com/users/mengxr/following{/other_user}","gists_url":"https://api.github.com/users/mengxr/gists{/gist_id}","starred_url":"https://api.github.com/users/mengxr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mengxr/subscriptions","organizations_url":"https://api.github.com/users/mengxr/orgs","repos_url":"https://api.github.com/users/mengxr/repos","events_url":"https://api.github.com/users/mengxr/events{/privacy}","received_events_url":"https://api.github.com/users/mengxr/received_events","type":"User","site_admin":false},"body":"`x` -> `iter`?","created_at":"2014-04-29T06:19:21Z","updated_at":"2014-04-29T06:19:21Z","html_url":"https://github.com/apache/spark/pull/493#discussion_r12080856","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/493","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/12080856"},"html":{"href":"https://github.com/apache/spark/pull/493#discussion_r12080856"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/493"}}}}