GitHub PullRequestReviewCommentEvent at 2014-12-16 23:27:35
Repository: PredictionIO
Actor: k4hoo
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/comments/21941664","id":21941664,"diff_hunk":"@@ -0,0 +1,81 @@\n+package io.prediction.examples.pfriendrecommendation\n+\n+import io.prediction.controller.PDataSource\n+import io.prediction.controller.EmptyEvaluationInfo\n+import io.prediction.controller.EmptyActualResult\n+import io.prediction.controller.Params\n+import io.prediction.data.storage.Event\n+import io.prediction.data.storage.Storage\n+\n+import org.apache.spark.SparkContext\n+import org.apache.spark.SparkContext._\n+import org.apache.spark.graphx._\n+import org.apache.spark.rdd.RDD\n+\n+import grizzled.slf4j.Logger\n+\n+/*\n+  Data Source Params : path to data file\n+ */\n+case class DataSourceParams(\n+  val graphEdgelistPath: String\n+) extends Params\n+\n+case class TrainingData(\n+  val g:Graph[Int,Int],\n+  val identityMatrix:RDD[(VertexId,Double)]\n+) extends Serializable\n+\n+class DataSource(val dsp: DataSourceParams )\n+  extends PDataSource[TrainingData, EmptyEvaluationInfo, Query, Double] {\n+\n+  override\n+  def readTraining(sc:SparkContext) : TrainingData = {\n+    val g = GraphLoader.edgeListFile(sc, dsp.graphEdgelistPath)\n+    // In the interest of space (since we calculate at most n*n simrank scores),\n+    // each of the n vertices should have vertexID in the range 0 to n-1\n+    // val g2 = DeltaSimRankRDD.normalizeGraph(g)\n+    val identity = DeltaSimRankRDD.identityMatrix(sc, g.vertices.count())\n+    new TrainingData(g, identity)\n+  }\n+}\n+\n+case class NodeSamplingDSParams(\n+  val graphEdgelistPath: String,\n+  val sampleFraction: Double\n+) extends Params\n+\n+class NodeSamplingDataSource(val dsp: NodeSamplingDSParams)\n+  extends PDataSource[TrainingData, EmptyEvaluationInfo, Query, Double] {\n+\n+  override\n+  def readTraining(sc:SparkContext) : TrainingData = {\n+    val g = GraphLoader.edgeListFile(sc, dsp.graphEdgelistPath)\n+    val sampled = Sampling.nodeSampling(sc, g, dsp.sampleFraction)\n+    val identity = DeltaSimRankRDD.identityMatrix(sc, g.vertices.count())\n+    new TrainingData(sampled, identity)\n+  }\n+}\n+\n+case class FFSamplingDSParams(\n+  val graphEdgelistPath: String,\n+  val sampleFraction: Double,\n+  val geoParam: Double\n+) extends Params\n+\n+class ForestFireSamplingDataSource(val dsp: FFSamplingDSParams)\n+  extends PDataSource[TrainingData, EmptyEvaluationInfo, Query, Double] {\n+\n+  override\n+  def readTraining(sc:SparkContext) : TrainingData = {\n+    val g = GraphLoader.edgeListFile(sc, dsp.graphEdgelistPath)\n+    val sampled = Sampling.forestFireSamplingInduced(\n+                                                  sc,\n+                                                  g,\n+                                                  dsp.sampleFraction,\n+                                                  dsp.geoParam)","path":"examples/experimental/scala-parallel-friend-recommendation/src/main/scala/DataSource.scala","position":76,"original_position":76,"commit_id":"33c9e2a7ad2b3ed367e087023fc9d04e9985da12","original_commit_id":"33c9e2a7ad2b3ed367e087023fc9d04e9985da12","user":{"login":"k4hoo","id":2480948,"avatar_url":"https://avatars.githubusercontent.com/u/2480948?v=3","gravatar_id":"","url":"https://api.github.com/users/k4hoo","html_url":"https://github.com/k4hoo","followers_url":"https://api.github.com/users/k4hoo/followers","following_url":"https://api.github.com/users/k4hoo/following{/other_user}","gists_url":"https://api.github.com/users/k4hoo/gists{/gist_id}","starred_url":"https://api.github.com/users/k4hoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k4hoo/subscriptions","organizations_url":"https://api.github.com/users/k4hoo/orgs","repos_url":"https://api.github.com/users/k4hoo/repos","events_url":"https://api.github.com/users/k4hoo/events{/privacy}","received_events_url":"https://api.github.com/users/k4hoo/received_events","type":"User","site_admin":false},"body":"The indentation should be:\r\nval sampled = Sampling.forestFireSamplingInduced(\r\n  sc,\r\n  g\r\n  dsp.sampleFraction,\r\n  dsp.geoParam)","created_at":"2014-12-16T23:27:35Z","updated_at":"2014-12-16T23:27:35Z","html_url":"https://github.com/PredictionIO/PredictionIO/pull/27#discussion_r21941664","pull_request_url":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/comments/21941664"},"html":{"href":"https://github.com/PredictionIO/PredictionIO/pull/27#discussion_r21941664"},"pull_request":{"href":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/27","id":25955241,"html_url":"https://github.com/PredictionIO/PredictionIO/pull/27","diff_url":"https://github.com/PredictionIO/PredictionIO/pull/27.diff","patch_url":"https://github.com/PredictionIO/PredictionIO/pull/27.patch","issue_url":"https://api.github.com/repos/PredictionIO/PredictionIO/issues/27","number":27,"state":"open","locked":false,"title":"parallel simrank","user":{"login":"ZhouYii","id":2171407,"avatar_url":"https://avatars.githubusercontent.com/u/2171407?v=3","gravatar_id":"","url":"https://api.github.com/users/ZhouYii","html_url":"https://github.com/ZhouYii","followers_url":"https://api.github.com/users/ZhouYii/followers","following_url":"https://api.github.com/users/ZhouYii/following{/other_user}","gists_url":"https://api.github.com/users/ZhouYii/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhouYii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhouYii/subscriptions","organizations_url":"https://api.github.com/users/ZhouYii/orgs","repos_url":"https://api.github.com/users/ZhouYii/repos","events_url":"https://api.github.com/users/ZhouYii/events{/privacy}","received_events_url":"https://api.github.com/users/ZhouYii/received_events","type":"User","site_admin":false},"body":"This is the parallel simrank engine pull request, separate from the local simrank and random engine.","created_at":"2014-12-12T06:47:58Z","updated_at":"2014-12-16T23:27:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"894d8ad617165fa952083fccfa5a5927a0f480f0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/27/commits","review_comments_url":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/27/comments","review_comment_url":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/comments/{number}","comments_url":"https://api.github.com/repos/PredictionIO/PredictionIO/issues/27/comments","statuses_url":"https://api.github.com/repos/PredictionIO/PredictionIO/statuses/33c9e2a7ad2b3ed367e087023fc9d04e9985da12","head":{"label":"ZhouYii:develop","ref":"develop","sha":"33c9e2a7ad2b3ed367e087023fc9d04e9985da12","user":{"login":"ZhouYii","id":2171407,"avatar_url":"https://avatars.githubusercontent.com/u/2171407?v=3","gravatar_id":"","url":"https://api.github.com/users/ZhouYii","html_url":"https://github.com/ZhouYii","followers_url":"https://api.github.com/users/ZhouYii/followers","following_url":"https://api.github.com/users/ZhouYii/following{/other_user}","gists_url":"https://api.github.com/users/ZhouYii/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhouYii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhouYii/subscriptions","organizations_url":"https://api.github.com/users/ZhouYii/orgs","repos_url":"https://api.github.com/users/ZhouYii/repos","events_url":"https://api.github.com/users/ZhouYii/events{/privacy}","received_events_url":"https://api.github.com/users/ZhouYii/received_events","type":"User","site_admin":false},"repo":{"id":27908732,"name":"PredictionIO","full_name":"ZhouYii/PredictionIO","owner":{"login":"ZhouYii","id":2171407,"avatar_url":"https://avatars.githubusercontent.com/u/2171407?v=3","gravatar_id":"","url":"https://api.github.com/users/ZhouYii","html_url":"https://github.com/ZhouYii","followers_url":"https://api.github.com/users/ZhouYii/followers","following_url":"https://api.github.com/users/ZhouYii/following{/other_user}","gists_url":"https://api.github.com/users/ZhouYii/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhouYii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhouYii/subscriptions","organizations_url":"https://api.github.com/users/ZhouYii/orgs","repos_url":"https://api.github.com/users/ZhouYii/repos","events_url":"https://api.github.com/users/ZhouYii/events{/privacy}","received_events_url":"https://api.github.com/users/ZhouYii/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ZhouYii/PredictionIO","description":"PredictionIO, a machine learning server for software developers and data engineers.","fork":true,"url":"https://api.github.com/repos/ZhouYii/PredictionIO","forks_url":"https://api.github.com/repos/ZhouYii/PredictionIO/forks","keys_url":"https://api.github.com/repos/ZhouYii/PredictionIO/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZhouYii/PredictionIO/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZhouYii/PredictionIO/teams","hooks_url":"https://api.github.com/repos/ZhouYii/PredictionIO/hooks","issue_events_url":"https://api.github.com/repos/ZhouYii/PredictionIO/issues/events{/number}","events_url":"https://api.github.com/repos/ZhouYii/PredictionIO/events","assignees_url":"https://api.github.com/repos/ZhouYii/PredictionIO/assignees{/user}","branches_url":"https://api.github.com/repos/ZhouYii/PredictionIO/branches{/branch}","tags_url":"https://api.github.com/repos/ZhouYii/PredictionIO/tags","blobs_url":"https://api.github.com/repos/ZhouYii/PredictionIO/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZhouYii/PredictionIO/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZhouYii/PredictionIO/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZhouYii/PredictionIO/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZhouYii/PredictionIO/statuses/{sha}","languages_url":"https://api.github.com/repos/ZhouYii/PredictionIO/languages","stargazers_url":"https://api.github.com/repos/ZhouYii/PredictionIO/stargazers","contributors_url":"https://api.github.com/repos/ZhouYii/PredictionIO/contributors","subscribers_url":"https://api.github.com/repos/ZhouYii/PredictionIO/subscribers","subscription_url":"https://api.github.com/repos/ZhouYii/PredictionIO/subscription","commits_url":"https://api.github.com/repos/ZhouYii/PredictionIO/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZhouYii/PredictionIO/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZhouYii/PredictionIO/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZhouYii/PredictionIO/issues/comments/{number}","contents_url":"https://api.github.com/repos/ZhouYii/PredictionIO/contents/{+path}","compare_url":"https://api.github.com/repos/ZhouYii/PredictionIO/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZhouYii/PredictionIO/merges","archive_url":"https://api.github.com/repos/ZhouYii/PredictionIO/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZhouYii/PredictionIO/downloads","issues_url":"https://api.github.com/repos/ZhouYii/PredictionIO/issues{/number}","pulls_url":"https://api.github.com/repos/ZhouYii/PredictionIO/pulls{/number}","milestones_url":"https://api.github.com/repos/ZhouYii/PredictionIO/milestones{/number}","notifications_url":"https://api.github.com/repos/ZhouYii/PredictionIO/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZhouYii/PredictionIO/labels{/name}","releases_url":"https://api.github.com/repos/ZhouYii/PredictionIO/releases{/id}","created_at":"2014-12-12T06:42:38Z","updated_at":"2014-12-16T23:12:25Z","pushed_at":"2014-12-16T23:12:25Z","git_url":"git://github.com/ZhouYii/PredictionIO.git","ssh_url":"git@github.com:ZhouYii/PredictionIO.git","clone_url":"https://github.com/ZhouYii/PredictionIO.git","svn_url":"https://github.com/ZhouYii/PredictionIO","homepage":"http://prediction.io/","size":22035,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"PredictionIO:develop","ref":"develop","sha":"e298b7fd8a627b4bb4975ba75fb9a77fe85cf84d","user":{"login":"PredictionIO","id":2992963,"avatar_url":"https://avatars.githubusercontent.com/u/2992963?v=3","gravatar_id":"","url":"https://api.github.com/users/PredictionIO","html_url":"https://github.com/PredictionIO","followers_url":"https://api.github.com/users/PredictionIO/followers","following_url":"https://api.github.com/users/PredictionIO/following{/other_user}","gists_url":"https://api.github.com/users/PredictionIO/gists{/gist_id}","starred_url":"https://api.github.com/users/PredictionIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PredictionIO/subscriptions","organizations_url":"https://api.github.com/users/PredictionIO/orgs","repos_url":"https://api.github.com/users/PredictionIO/repos","events_url":"https://api.github.com/users/PredictionIO/events{/privacy}","received_events_url":"https://api.github.com/users/PredictionIO/received_events","type":"Organization","site_admin":false},"repo":{"id":7827081,"name":"PredictionIO","full_name":"PredictionIO/PredictionIO","owner":{"login":"PredictionIO","id":2992963,"avatar_url":"https://avatars.githubusercontent.com/u/2992963?v=3","gravatar_id":"","url":"https://api.github.com/users/PredictionIO","html_url":"https://github.com/PredictionIO","followers_url":"https://api.github.com/users/PredictionIO/followers","following_url":"https://api.github.com/users/PredictionIO/following{/other_user}","gists_url":"https://api.github.com/users/PredictionIO/gists{/gist_id}","starred_url":"https://api.github.com/users/PredictionIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PredictionIO/subscriptions","organizations_url":"https://api.github.com/users/PredictionIO/orgs","repos_url":"https://api.github.com/users/PredictionIO/repos","events_url":"https://api.github.com/users/PredictionIO/events{/privacy}","received_events_url":"https://api.github.com/users/PredictionIO/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PredictionIO/PredictionIO","description":"PredictionIO, a machine learning server for software developers and data engineers.","fork":false,"url":"https://api.github.com/repos/PredictionIO/PredictionIO","forks_url":"https://api.github.com/repos/PredictionIO/PredictionIO/forks","keys_url":"https://api.github.com/repos/PredictionIO/PredictionIO/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PredictionIO/PredictionIO/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PredictionIO/PredictionIO/teams","hooks_url":"https://api.github.com/repos/PredictionIO/PredictionIO/hooks","issue_events_url":"https://api.github.com/repos/PredictionIO/PredictionIO/issues/events{/number}","events_url":"https://api.github.com/repos/PredictionIO/PredictionIO/events","assignees_url":"https://api.github.com/repos/PredictionIO/PredictionIO/assignees{/user}","branches_url":"https://api.github.com/repos/PredictionIO/PredictionIO/branches{/branch}","tags_url":"https://api.github.com/repos/PredictionIO/PredictionIO/tags","blobs_url":"https://api.github.com/repos/PredictionIO/PredictionIO/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PredictionIO/PredictionIO/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PredictionIO/PredictionIO/git/refs{/sha}","trees_url":"https://api.github.com/repos/PredictionIO/PredictionIO/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PredictionIO/PredictionIO/statuses/{sha}","languages_url":"https://api.github.com/repos/PredictionIO/PredictionIO/languages","stargazers_url":"https://api.github.com/repos/PredictionIO/PredictionIO/stargazers","contributors_url":"https://api.github.com/repos/PredictionIO/PredictionIO/contributors","subscribers_url":"https://api.github.com/repos/PredictionIO/PredictionIO/subscribers","subscription_url":"https://api.github.com/repos/PredictionIO/PredictionIO/subscription","commits_url":"https://api.github.com/repos/PredictionIO/PredictionIO/commits{/sha}","git_commits_url":"https://api.github.com/repos/PredictionIO/PredictionIO/git/commits{/sha}","comments_url":"https://api.github.com/repos/PredictionIO/PredictionIO/comments{/number}","issue_comment_url":"https://api.github.com/repos/PredictionIO/PredictionIO/issues/comments/{number}","contents_url":"https://api.github.com/repos/PredictionIO/PredictionIO/contents/{+path}","compare_url":"https://api.github.com/repos/PredictionIO/PredictionIO/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PredictionIO/PredictionIO/merges","archive_url":"https://api.github.com/repos/PredictionIO/PredictionIO/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PredictionIO/PredictionIO/downloads","issues_url":"https://api.github.com/repos/PredictionIO/PredictionIO/issues{/number}","pulls_url":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls{/number}","milestones_url":"https://api.github.com/repos/PredictionIO/PredictionIO/milestones{/number}","notifications_url":"https://api.github.com/repos/PredictionIO/PredictionIO/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PredictionIO/PredictionIO/labels{/name}","releases_url":"https://api.github.com/repos/PredictionIO/PredictionIO/releases{/id}","created_at":"2013-01-25T19:42:32Z","updated_at":"2014-12-16T21:35:20Z","pushed_at":"2014-12-16T00:06:09Z","git_url":"git://github.com/PredictionIO/PredictionIO.git","ssh_url":"git@github.com:PredictionIO/PredictionIO.git","clone_url":"https://github.com/PredictionIO/PredictionIO.git","svn_url":"https://github.com/PredictionIO/PredictionIO","homepage":"http://prediction.io/","size":22035,"stargazers_count":5584,"watchers_count":5584,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":502,"mirror_url":null,"open_issues_count":7,"forks":502,"open_issues":7,"watchers":5584,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/27"},"html":{"href":"https://github.com/PredictionIO/PredictionIO/pull/27"},"issue":{"href":"https://api.github.com/repos/PredictionIO/PredictionIO/issues/27"},"comments":{"href":"https://api.github.com/repos/PredictionIO/PredictionIO/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/PredictionIO/PredictionIO/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/PredictionIO/PredictionIO/statuses/33c9e2a7ad2b3ed367e087023fc9d04e9985da12"}}}}