{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-systemml/pulls/comments/72897675","id":72897675,"diff_hunk":"@@ -0,0 +1,131 @@\n+X = read($X)\n+\n+distance_matrix = function(matrix[double] X)\n+  return (matrix[double] out) {\n+    n = nrow(X)\n+    s = rowSums(X * X)\n+    out = - 2*X %*% t(X) + s + t(s)\n+  }\n+\n+x2p = function(matrix[double] X, double tol, double perplexity)\n+  return(matrix[double] P) {\n+    INF = 1.0e20\n+    n = nrow(X)\n+    D = distance_matrix(X)\n+\n+    P = matrix(0, rows=n, cols=n)\n+    beta = matrix(1, rows=n, cols=1)\n+    logU = log(perplexity)\n+\n+    for (i in 1:n) {\n+      betamin = 0 # beta cannot be negative\n+      betamax = INF\n+      Hdiff = INF\n+      itr = 0\n+\n+      while (abs(Hdiff) > tol & itr < 50) {\n+        P[i,] = exp(-D[i,] * beta[i,1])\n+        P[i,i] = 0.\n+        sum_Pi = sum(P[i,])\n+\n+        H = log(sum_Pi) + beta[i,1] * sum(D[i,] * P[i,]) / sum_Pi\n+        P[i,] = P[i,]/sum_Pi\n+\n+        Hdiff = as.scalar(H - logU)\n+        # print(i + \" \" + itr + \" \" +  as.scalar(D[i,1]) + \" \" + as.scalar(beta[i,1]) +\n+        #   \" \" + as.scalar(P[i,1]) + \" \" + sum_Pi + \" \" + as.scalar(H[1,1]))\n+        if (Hdiff > 0.) {\n+          betamin = as.scalar(beta[i,1])\n+          if (betamax == INF) {\n+            beta[i,1] = beta[i,1] * 2.\n+          } else {\n+             beta[i,1] = (beta[i,1] + betamax) / 2.\n+          }\n+        } else {\n+          betamax = as.scalar(beta[i,1])\n+          if (betamin == 0.) {\n+            beta[i,1] = beta[i,1] / 2.\n+          } else {\n+            beta[i,1] = (beta[i,1] + betamin) / 2.\n+          }\n+        }\n+        itr = itr + 1\n+      }\n+    }\n+    P = P + t(P)\n+    P = P / sum(P)\n+  }\n+\n+tsne = function(matrix[double] X, int reduced_dims, int initial_dims, int perplexity)\n+  return(matrix[double] Y, matrix[double] C) {\n+    d = reduced_dims\n+    n = nrow(X)\n+\n+    max_iter = 2000\n+    eta = 500\n+\n+    P = x2p(X, 1.0e-5, 20.0)\n+    P = P*4\n+    Y = rand(rows=n, cols=d, pdf=\"normal\")\n+    C = matrix(0, rows=max_iter, cols=1)\n+\n+    for (itr in 1:max_iter) {\n+      D = distance_matrix(Y)\n+      Z = 1/(D + 1)\n+      parfor (j in 1:n) {","path":"scripts/staging/tSNE.dml","position":75,"original_position":75,"commit_id":"5ccb45cebaabfd431c86eae7322d565767d38d03","original_commit_id":"5ccb45cebaabfd431c86eae7322d565767d38d03","user":{"login":"mboehm7","id":13721609,"avatar_url":"https://avatars.githubusercontent.com/u/13721609?v=3","gravatar_id":"","url":"https://api.github.com/users/mboehm7","html_url":"https://github.com/mboehm7","followers_url":"https://api.github.com/users/mboehm7/followers","following_url":"https://api.github.com/users/mboehm7/following{/other_user}","gists_url":"https://api.github.com/users/mboehm7/gists{/gist_id}","starred_url":"https://api.github.com/users/mboehm7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mboehm7/subscriptions","organizations_url":"https://api.github.com/users/mboehm7/orgs","repos_url":"https://api.github.com/users/mboehm7/repos","events_url":"https://api.github.com/users/mboehm7/events{/privacy}","received_events_url":"https://api.github.com/users/mboehm7/received_events","type":"User","site_admin":false},"body":"that's a very nice vectorization; just one thing to keep in mind: if Z contains NaN or +-INF the results would not be equivalent. However, as we have limited NaN support (other than primitives to removed them), it should be ok.","created_at":"2016-07-31T04:14:44Z","updated_at":"2016-07-31T04:14:44Z","html_url":"https://github.com/apache/incubator-systemml/pull/200#discussion_r72897675","pull_request_url":"https://api.github.com/repos/apache/incubator-systemml/pulls/200","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-systemml/pulls/comments/72897675"},"html":{"href":"https://github.com/apache/incubator-systemml/pull/200#discussion_r72897675"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-systemml/pulls/200"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-systemml/pulls/200","id":79433825,"html_url":"https://github.com/apache/incubator-systemml/pull/200","diff_url":"https://github.com/apache/incubator-systemml/pull/200.diff","patch_url":"https://github.com/apache/incubator-systemml/pull/200.patch","issue_url":"https://api.github.com/repos/apache/incubator-systemml/issues/200","number":200,"state":"open","locked":false,"title":"[SYSTEMML-831][WIP] Implement t-SNE algorithm","user":{"login":"iyounus","id":8313847,"avatar_url":"https://avatars.githubusercontent.com/u/8313847?v=3","gravatar_id":"","url":"https://api.github.com/users/iyounus","html_url":"https://github.com/iyounus","followers_url":"https://api.github.com/users/iyounus/followers","following_url":"https://api.github.com/users/iyounus/following{/other_user}","gists_url":"https://api.github.com/users/iyounus/gists{/gist_id}","starred_url":"https://api.github.com/users/iyounus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iyounus/subscriptions","organizations_url":"https://api.github.com/users/iyounus/orgs","repos_url":"https://api.github.com/users/iyounus/repos","events_url":"https://api.github.com/users/iyounus/events{/privacy}","received_events_url":"https://api.github.com/users/iyounus/received_events","type":"User","site_admin":false},"body":"This is the first commit for tSNE in dml. At the moment this is using batch gradient method which will no scale. Next step is to implement stochastic gradient method to improve performance.\r\n\r\nIts was tested in stand alone mode. The results from the algorithm are correct. I still need to test this on distributed data. No performance stats are available at this time.\r\n\r\n@niketanpansare @dusenberrymw @mboehm7 @nakul02 ","created_at":"2016-07-29T22:30:39Z","updated_at":"2016-07-31T04:14:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"572bd2150c68ca5136fd72bc149837b6bd52f19e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-systemml/pulls/200/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-systemml/pulls/200/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-systemml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-systemml/issues/200/comments","statuses_url":"https://api.github.com/repos/apache/incubator-systemml/statuses/5ccb45cebaabfd431c86eae7322d565767d38d03","head":{"label":"iyounus:SYSTEMML-831_Implement_tSNE","ref":"SYSTEMML-831_Implement_tSNE","sha":"5ccb45cebaabfd431c86eae7322d565767d38d03","user":{"login":"iyounus","id":8313847,"avatar_url":"https://avatars.githubusercontent.com/u/8313847?v=3","gravatar_id":"","url":"https://api.github.com/users/iyounus","html_url":"https://github.com/iyounus","followers_url":"https://api.github.com/users/iyounus/followers","following_url":"https://api.github.com/users/iyounus/following{/other_user}","gists_url":"https://api.github.com/users/iyounus/gists{/gist_id}","starred_url":"https://api.github.com/users/iyounus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iyounus/subscriptions","organizations_url":"https://api.github.com/users/iyounus/orgs","repos_url":"https://api.github.com/users/iyounus/repos","events_url":"https://api.github.com/users/iyounus/events{/privacy}","received_events_url":"https://api.github.com/users/iyounus/received_events","type":"User","site_admin":false},"repo":{"id":64512997,"name":"incubator-systemml","full_name":"iyounus/incubator-systemml","owner":{"login":"iyounus","id":8313847,"avatar_url":"https://avatars.githubusercontent.com/u/8313847?v=3","gravatar_id":"","url":"https://api.github.com/users/iyounus","html_url":"https://github.com/iyounus","followers_url":"https://api.github.com/users/iyounus/followers","following_url":"https://api.github.com/users/iyounus/following{/other_user}","gists_url":"https://api.github.com/users/iyounus/gists{/gist_id}","starred_url":"https://api.github.com/users/iyounus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iyounus/subscriptions","organizations_url":"https://api.github.com/users/iyounus/orgs","repos_url":"https://api.github.com/users/iyounus/repos","events_url":"https://api.github.com/users/iyounus/events{/privacy}","received_events_url":"https://api.github.com/users/iyounus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iyounus/incubator-systemml","description":"Mirror of Apache SystemML (Incubating)","fork":true,"url":"https://api.github.com/repos/iyounus/incubator-systemml","forks_url":"https://api.github.com/repos/iyounus/incubator-systemml/forks","keys_url":"https://api.github.com/repos/iyounus/incubator-systemml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iyounus/incubator-systemml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iyounus/incubator-systemml/teams","hooks_url":"https://api.github.com/repos/iyounus/incubator-systemml/hooks","issue_events_url":"https://api.github.com/repos/iyounus/incubator-systemml/issues/events{/number}","events_url":"https://api.github.com/repos/iyounus/incubator-systemml/events","assignees_url":"https://api.github.com/repos/iyounus/incubator-systemml/assignees{/user}","branches_url":"https://api.github.com/repos/iyounus/incubator-systemml/branches{/branch}","tags_url":"https://api.github.com/repos/iyounus/incubator-systemml/tags","blobs_url":"https://api.github.com/repos/iyounus/incubator-systemml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iyounus/incubator-systemml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iyounus/incubator-systemml/git/refs{/sha}","trees_url":"https://api.github.com/repos/iyounus/incubator-systemml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iyounus/incubator-systemml/statuses/{sha}","languages_url":"https://api.github.com/repos/iyounus/incubator-systemml/languages","stargazers_url":"https://api.github.com/repos/iyounus/incubator-systemml/stargazers","contributors_url":"https://api.github.com/repos/iyounus/incubator-systemml/contributors","subscribers_url":"https://api.github.com/repos/iyounus/incubator-systemml/subscribers","subscription_url":"https://api.github.com/repos/iyounus/incubator-systemml/subscription","commits_url":"https://api.github.com/repos/iyounus/incubator-systemml/commits{/sha}","git_commits_url":"https://api.github.com/repos/iyounus/incubator-systemml/git/commits{/sha}","comments_url":"https://api.github.com/repos/iyounus/incubator-systemml/comments{/number}","issue_comment_url":"https://api.github.com/repos/iyounus/incubator-systemml/issues/comments{/number}","contents_url":"https://api.github.com/repos/iyounus/incubator-systemml/contents/{+path}","compare_url":"https://api.github.com/repos/iyounus/incubator-systemml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iyounus/incubator-systemml/merges","archive_url":"https://api.github.com/repos/iyounus/incubator-systemml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iyounus/incubator-systemml/downloads","issues_url":"https://api.github.com/repos/iyounus/incubator-systemml/issues{/number}","pulls_url":"https://api.github.com/repos/iyounus/incubator-systemml/pulls{/number}","milestones_url":"https://api.github.com/repos/iyounus/incubator-systemml/milestones{/number}","notifications_url":"https://api.github.com/repos/iyounus/incubator-systemml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iyounus/incubator-systemml/labels{/name}","releases_url":"https://api.github.com/repos/iyounus/incubator-systemml/releases{/id}","deployments_url":"https://api.github.com/repos/iyounus/incubator-systemml/deployments","created_at":"2016-07-29T22:04:49Z","updated_at":"2016-07-29T22:04:58Z","pushed_at":"2016-07-29T22:24:26Z","git_url":"git://github.com/iyounus/incubator-systemml.git","ssh_url":"git@github.com:iyounus/incubator-systemml.git","clone_url":"https://github.com/iyounus/incubator-systemml.git","svn_url":"https://github.com/iyounus/incubator-systemml","homepage":null,"size":187874,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"master"}},"base":{"label":"apache:master","ref":"master","sha":"13211190f4732ea9b21d3698b62f0aa6bd127ed4","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":45896813,"name":"incubator-systemml","full_name":"apache/incubator-systemml","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/incubator-systemml","description":"Mirror of Apache SystemML (Incubating)","fork":false,"url":"https://api.github.com/repos/apache/incubator-systemml","forks_url":"https://api.github.com/repos/apache/incubator-systemml/forks","keys_url":"https://api.github.com/repos/apache/incubator-systemml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-systemml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-systemml/teams","hooks_url":"https://api.github.com/repos/apache/incubator-systemml/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-systemml/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-systemml/events","assignees_url":"https://api.github.com/repos/apache/incubator-systemml/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-systemml/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-systemml/tags","blobs_url":"https://api.github.com/repos/apache/incubator-systemml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-systemml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-systemml/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-systemml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-systemml/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-systemml/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-systemml/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-systemml/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-systemml/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-systemml/subscription","commits_url":"https://api.github.com/repos/apache/incubator-systemml/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-systemml/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-systemml/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-systemml/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-systemml/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-systemml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-systemml/merges","archive_url":"https://api.github.com/repos/apache/incubator-systemml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-systemml/downloads","issues_url":"https://api.github.com/repos/apache/incubator-systemml/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-systemml/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-systemml/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-systemml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-systemml/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-systemml/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-systemml/deployments","created_at":"2015-11-10T08:00:06Z","updated_at":"2016-07-29T21:34:18Z","pushed_at":"2016-07-30T23:15:26Z","git_url":"git://github.com/apache/incubator-systemml.git","ssh_url":"git@github.com:apache/incubator-systemml.git","clone_url":"https://github.com/apache/incubator-systemml.git","svn_url":"https://github.com/apache/incubator-systemml","homepage":null,"size":192081,"stargazers_count":364,"watchers_count":364,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":128,"mirror_url":"git://git.apache.org/incubator-systemml.git","open_issues_count":8,"forks":128,"open_issues":8,"watchers":364,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-systemml/pulls/200"},"html":{"href":"https://github.com/apache/incubator-systemml/pull/200"},"issue":{"href":"https://api.github.com/repos/apache/incubator-systemml/issues/200"},"comments":{"href":"https://api.github.com/repos/apache/incubator-systemml/issues/200/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-systemml/pulls/200/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-systemml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-systemml/pulls/200/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-systemml/statuses/5ccb45cebaabfd431c86eae7322d565767d38d03"}}}}
{"actor":{"display_login":"mboehm7"}}