{"action":"created","comment":{"url":"https://api.github.com/repos/numenta/nupic/pulls/comments/46877826","id":46877826,"diff_hunk":"@@ -1424,16 +1422,11 @@ def _inhibitColumnsGlobal(self, overlaps, density):\n     #calculate num active per inhibition area\n     numActive = int(density * self._numColumns)\n \n-    # argpartition returns an array where all values to the left of index\n-    # numActive are less than or equal to all values to its right. Negating\n-    # overlaps produces a descending-order partition.\n-    winnerIndices = numpy.argpartition(-overlaps, numActive)[:numActive]\n-\n-    # Compatibility with nupic.core requires that the winners are sorted;\n-    # however, sorting only the winners is far less expensive than sorting all\n-    # columns.\n-    winnerValues = overlaps[winnerIndices]\n-    sortedWinnerIndices = winnerIndices[numpy.argsort(-winnerValues)]\n+    # Calculate winners using stable sort algorithm (mergesort)\n+    # for compatibility with C++\n+    indices = numpy.array(xrange(self._numColumns), dtype=uintType)\n+    winnerIndices = indices[numpy.argsort(overlaps, kind='mergesort')]\n+    sortedWinnerIndices = winnerIndices[-numActive:][::-1]\n ","path":"src/nupic/research/spatial_pooler.py","position":79,"original_position":79,"commit_id":"e649c7186be2d9dcc44f8feb3b504dbb282d875d","original_commit_id":"e649c7186be2d9dcc44f8feb3b504dbb282d875d","user":{"login":"SaganBolliger","id":6234732,"avatar_url":"https://avatars.githubusercontent.com/u/6234732?v=3","gravatar_id":"","url":"https://api.github.com/users/SaganBolliger","html_url":"https://github.com/SaganBolliger","followers_url":"https://api.github.com/users/SaganBolliger/followers","following_url":"https://api.github.com/users/SaganBolliger/following{/other_user}","gists_url":"https://api.github.com/users/SaganBolliger/gists{/gist_id}","starred_url":"https://api.github.com/users/SaganBolliger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SaganBolliger/subscriptions","organizations_url":"https://api.github.com/users/SaganBolliger/orgs","repos_url":"https://api.github.com/users/SaganBolliger/repos","events_url":"https://api.github.com/users/SaganBolliger/events{/privacy}","received_events_url":"https://api.github.com/users/SaganBolliger/received_events","type":"User","site_admin":false},"body":"@chetan51 This was an optimization that I implemented. We discussed how this optimization has to be reversed due to the lack of a stable sort version of argpartition. However, it looks like this reverted version does some unnecessary work. What would be wrong with this?:\r\n\r\n```\r\nsortedWinnerIndices = numpy.argsort(-overlaps, kind='mergesort')[:numActive]\r\n```","created_at":"2015-12-07T21:10:57Z","updated_at":"2015-12-07T21:10:57Z","html_url":"https://github.com/numenta/nupic/pull/2755#discussion_r46877826","pull_request_url":"https://api.github.com/repos/numenta/nupic/pulls/2755","_links":{"self":{"href":"https://api.github.com/repos/numenta/nupic/pulls/comments/46877826"},"html":{"href":"https://github.com/numenta/nupic/pull/2755#discussion_r46877826"},"pull_request":{"href":"https://api.github.com/repos/numenta/nupic/pulls/2755"}}},"pull_request":{"url":"https://api.github.com/repos/numenta/nupic/pulls/2755","id":50583923,"html_url":"https://github.com/numenta/nupic/pull/2755","diff_url":"https://github.com/numenta/nupic/pull/2755.diff","patch_url":"https://github.com/numenta/nupic/pull/2755.patch","issue_url":"https://api.github.com/repos/numenta/nupic/issues/2755","number":2755,"state":"open","locked":false,"title":"Make python SP and C++ SP compatible","user":{"login":"chetan51","id":310282,"avatar_url":"https://avatars.githubusercontent.com/u/310282?v=3","gravatar_id":"","url":"https://api.github.com/users/chetan51","html_url":"https://github.com/chetan51","followers_url":"https://api.github.com/users/chetan51/followers","following_url":"https://api.github.com/users/chetan51/following{/other_user}","gists_url":"https://api.github.com/users/chetan51/gists{/gist_id}","starred_url":"https://api.github.com/users/chetan51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chetan51/subscriptions","organizations_url":"https://api.github.com/users/chetan51/orgs","repos_url":"https://api.github.com/users/chetan51/repos","events_url":"https://api.github.com/users/chetan51/events{/privacy}","received_events_url":"https://api.github.com/users/chetan51/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/numenta/nupic/issues/2754.","created_at":"2015-11-12T23:26:29Z","updated_at":"2015-12-07T21:10:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93506f1039bdf81898bbfe086d33012babaed84e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/numenta/nupic/pulls/2755/commits","review_comments_url":"https://api.github.com/repos/numenta/nupic/pulls/2755/comments","review_comment_url":"https://api.github.com/repos/numenta/nupic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/numenta/nupic/issues/2755/comments","statuses_url":"https://api.github.com/repos/numenta/nupic/statuses/e649c7186be2d9dcc44f8feb3b504dbb282d875d","head":{"label":"chetan51:cpp_sp","ref":"cpp_sp","sha":"e649c7186be2d9dcc44f8feb3b504dbb282d875d","user":{"login":"chetan51","id":310282,"avatar_url":"https://avatars.githubusercontent.com/u/310282?v=3","gravatar_id":"","url":"https://api.github.com/users/chetan51","html_url":"https://github.com/chetan51","followers_url":"https://api.github.com/users/chetan51/followers","following_url":"https://api.github.com/users/chetan51/following{/other_user}","gists_url":"https://api.github.com/users/chetan51/gists{/gist_id}","starred_url":"https://api.github.com/users/chetan51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chetan51/subscriptions","organizations_url":"https://api.github.com/users/chetan51/orgs","repos_url":"https://api.github.com/users/chetan51/repos","events_url":"https://api.github.com/users/chetan51/events{/privacy}","received_events_url":"https://api.github.com/users/chetan51/received_events","type":"User","site_admin":false},"repo":{"id":10465001,"name":"nupic","full_name":"chetan51/nupic","owner":{"login":"chetan51","id":310282,"avatar_url":"https://avatars.githubusercontent.com/u/310282?v=3","gravatar_id":"","url":"https://api.github.com/users/chetan51","html_url":"https://github.com/chetan51","followers_url":"https://api.github.com/users/chetan51/followers","following_url":"https://api.github.com/users/chetan51/following{/other_user}","gists_url":"https://api.github.com/users/chetan51/gists{/gist_id}","starred_url":"https://api.github.com/users/chetan51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chetan51/subscriptions","organizations_url":"https://api.github.com/users/chetan51/orgs","repos_url":"https://api.github.com/users/chetan51/repos","events_url":"https://api.github.com/users/chetan51/events{/privacy}","received_events_url":"https://api.github.com/users/chetan51/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chetan51/nupic","description":"","fork":true,"url":"https://api.github.com/repos/chetan51/nupic","forks_url":"https://api.github.com/repos/chetan51/nupic/forks","keys_url":"https://api.github.com/repos/chetan51/nupic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chetan51/nupic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chetan51/nupic/teams","hooks_url":"https://api.github.com/repos/chetan51/nupic/hooks","issue_events_url":"https://api.github.com/repos/chetan51/nupic/issues/events{/number}","events_url":"https://api.github.com/repos/chetan51/nupic/events","assignees_url":"https://api.github.com/repos/chetan51/nupic/assignees{/user}","branches_url":"https://api.github.com/repos/chetan51/nupic/branches{/branch}","tags_url":"https://api.github.com/repos/chetan51/nupic/tags","blobs_url":"https://api.github.com/repos/chetan51/nupic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chetan51/nupic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chetan51/nupic/git/refs{/sha}","trees_url":"https://api.github.com/repos/chetan51/nupic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chetan51/nupic/statuses/{sha}","languages_url":"https://api.github.com/repos/chetan51/nupic/languages","stargazers_url":"https://api.github.com/repos/chetan51/nupic/stargazers","contributors_url":"https://api.github.com/repos/chetan51/nupic/contributors","subscribers_url":"https://api.github.com/repos/chetan51/nupic/subscribers","subscription_url":"https://api.github.com/repos/chetan51/nupic/subscription","commits_url":"https://api.github.com/repos/chetan51/nupic/commits{/sha}","git_commits_url":"https://api.github.com/repos/chetan51/nupic/git/commits{/sha}","comments_url":"https://api.github.com/repos/chetan51/nupic/comments{/number}","issue_comment_url":"https://api.github.com/repos/chetan51/nupic/issues/comments{/number}","contents_url":"https://api.github.com/repos/chetan51/nupic/contents/{+path}","compare_url":"https://api.github.com/repos/chetan51/nupic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chetan51/nupic/merges","archive_url":"https://api.github.com/repos/chetan51/nupic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chetan51/nupic/downloads","issues_url":"https://api.github.com/repos/chetan51/nupic/issues{/number}","pulls_url":"https://api.github.com/repos/chetan51/nupic/pulls{/number}","milestones_url":"https://api.github.com/repos/chetan51/nupic/milestones{/number}","notifications_url":"https://api.github.com/repos/chetan51/nupic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chetan51/nupic/labels{/name}","releases_url":"https://api.github.com/repos/chetan51/nupic/releases{/id}","created_at":"2013-06-03T21:22:28Z","updated_at":"2015-02-03T00:10:01Z","pushed_at":"2015-12-07T19:54:56Z","git_url":"git://github.com/chetan51/nupic.git","ssh_url":"git@github.com:chetan51/nupic.git","clone_url":"https://github.com/chetan51/nupic.git","svn_url":"https://github.com/chetan51/nupic","homepage":null,"size":144077,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"numenta:master","ref":"master","sha":"bd8e6a914444d0e88ff0cdabc960102f5a3b199f","user":{"login":"numenta","id":1039191,"avatar_url":"https://avatars.githubusercontent.com/u/1039191?v=3","gravatar_id":"","url":"https://api.github.com/users/numenta","html_url":"https://github.com/numenta","followers_url":"https://api.github.com/users/numenta/followers","following_url":"https://api.github.com/users/numenta/following{/other_user}","gists_url":"https://api.github.com/users/numenta/gists{/gist_id}","starred_url":"https://api.github.com/users/numenta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numenta/subscriptions","organizations_url":"https://api.github.com/users/numenta/orgs","repos_url":"https://api.github.com/users/numenta/repos","events_url":"https://api.github.com/users/numenta/events{/privacy}","received_events_url":"https://api.github.com/users/numenta/received_events","type":"Organization","site_admin":false},"repo":{"id":9252533,"name":"nupic","full_name":"numenta/nupic","owner":{"login":"numenta","id":1039191,"avatar_url":"https://avatars.githubusercontent.com/u/1039191?v=3","gravatar_id":"","url":"https://api.github.com/users/numenta","html_url":"https://github.com/numenta","followers_url":"https://api.github.com/users/numenta/followers","following_url":"https://api.github.com/users/numenta/following{/other_user}","gists_url":"https://api.github.com/users/numenta/gists{/gist_id}","starred_url":"https://api.github.com/users/numenta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numenta/subscriptions","organizations_url":"https://api.github.com/users/numenta/orgs","repos_url":"https://api.github.com/users/numenta/repos","events_url":"https://api.github.com/users/numenta/events{/privacy}","received_events_url":"https://api.github.com/users/numenta/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/numenta/nupic","description":"Numenta Platform for Intelligent Computing: a brain-inspired machine intelligence platform, and biologically accurate neural network based on cortical learning algorithms.","fork":false,"url":"https://api.github.com/repos/numenta/nupic","forks_url":"https://api.github.com/repos/numenta/nupic/forks","keys_url":"https://api.github.com/repos/numenta/nupic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/numenta/nupic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/numenta/nupic/teams","hooks_url":"https://api.github.com/repos/numenta/nupic/hooks","issue_events_url":"https://api.github.com/repos/numenta/nupic/issues/events{/number}","events_url":"https://api.github.com/repos/numenta/nupic/events","assignees_url":"https://api.github.com/repos/numenta/nupic/assignees{/user}","branches_url":"https://api.github.com/repos/numenta/nupic/branches{/branch}","tags_url":"https://api.github.com/repos/numenta/nupic/tags","blobs_url":"https://api.github.com/repos/numenta/nupic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/numenta/nupic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/numenta/nupic/git/refs{/sha}","trees_url":"https://api.github.com/repos/numenta/nupic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/numenta/nupic/statuses/{sha}","languages_url":"https://api.github.com/repos/numenta/nupic/languages","stargazers_url":"https://api.github.com/repos/numenta/nupic/stargazers","contributors_url":"https://api.github.com/repos/numenta/nupic/contributors","subscribers_url":"https://api.github.com/repos/numenta/nupic/subscribers","subscription_url":"https://api.github.com/repos/numenta/nupic/subscription","commits_url":"https://api.github.com/repos/numenta/nupic/commits{/sha}","git_commits_url":"https://api.github.com/repos/numenta/nupic/git/commits{/sha}","comments_url":"https://api.github.com/repos/numenta/nupic/comments{/number}","issue_comment_url":"https://api.github.com/repos/numenta/nupic/issues/comments{/number}","contents_url":"https://api.github.com/repos/numenta/nupic/contents/{+path}","compare_url":"https://api.github.com/repos/numenta/nupic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/numenta/nupic/merges","archive_url":"https://api.github.com/repos/numenta/nupic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/numenta/nupic/downloads","issues_url":"https://api.github.com/repos/numenta/nupic/issues{/number}","pulls_url":"https://api.github.com/repos/numenta/nupic/pulls{/number}","milestones_url":"https://api.github.com/repos/numenta/nupic/milestones{/number}","notifications_url":"https://api.github.com/repos/numenta/nupic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/numenta/nupic/labels{/name}","releases_url":"https://api.github.com/repos/numenta/nupic/releases{/id}","created_at":"2013-04-05T23:14:27Z","updated_at":"2015-12-07T05:51:36Z","pushed_at":"2015-12-07T19:54:59Z","git_url":"git://github.com/numenta/nupic.git","ssh_url":"git@github.com:numenta/nupic.git","clone_url":"https://github.com/numenta/nupic.git","svn_url":"https://github.com/numenta/nupic","homepage":"http://numenta.org/","size":281414,"stargazers_count":3642,"watchers_count":3642,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":990,"mirror_url":null,"open_issues_count":450,"forks":990,"open_issues":450,"watchers":3642,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/numenta/nupic/pulls/2755"},"html":{"href":"https://github.com/numenta/nupic/pull/2755"},"issue":{"href":"https://api.github.com/repos/numenta/nupic/issues/2755"},"comments":{"href":"https://api.github.com/repos/numenta/nupic/issues/2755/comments"},"review_comments":{"href":"https://api.github.com/repos/numenta/nupic/pulls/2755/comments"},"review_comment":{"href":"https://api.github.com/repos/numenta/nupic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/numenta/nupic/pulls/2755/commits"},"statuses":{"href":"https://api.github.com/repos/numenta/nupic/statuses/e649c7186be2d9dcc44f8feb3b504dbb282d875d"}}}}