{"action":"created","comment":{"url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/comments/240020788","pull_request_review_id":182961444,"id":240020788,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDAyMDc4OA==","diff_hunk":"@@ -0,0 +1,164 @@\n+import os\n+import sys\n+import random\n+import math\n+import numpy as np\n+import pandas as pd\n+import scipy\n+\n+def get_books_from_indices(top_book_indices, books):\n+    top_books = []\n+    for i in range(len(top_book_indices)):\n+        book_id = top_book_indices[i]\n+        book = books.iloc[book_id - 1]  # index is book_id - 1\n+        book['rank'] = i + 1\n+\n+        # for some reason, some of the text fields have newlines appended to them\n+        book['title'] = book['title'].strip()\n+        book['author'] = book['author'].strip()\n+        top_books.append(book)\n+    return top_books\n+\n+\n+def get_top_n_recs(result, books, n, q):\n+    recs = []\n+    for i in range(len(result)):\n+        if q[i] == 0:  # book user hasn't already rated\n+            recs.append((i, result[i]))\n+        else:\n+            recs.append((i, float('-inf')))\n+    recs = sorted(recs, key=lambda tup: tup[1], reverse=True)\n+    print(\"finished sorting recs\")\n+\n+    top_books = []\n+    for i in range(n):\n+        book_id = recs[i][0]\n+        book = books.iloc[book_id]\n+        book['rank'] = i + 1\n+\n+        # for some reason, some of the text fields have newlines appended to them\n+        book['title'] = book['title'].strip()\n+        book['author'] = book['author'].strip()\n+        top_books.append(book)\n+\n+    return top_books\n+\n+\n+def most_popular(books, n):\n+    top_books = []\n+    for i in range(n):\n+        book = books.iloc[i]\n+        book['rank'] = i + 1\n+\n+        # for some reason, some of the text fields have newlines appended to them\n+        book['title'] = book['title'].strip()\n+        book['author'] = book['author'].strip()\n+        top_books.append(book)\n+\n+    return top_books\n+\n+\n+def map_user(q, V):","path":"WebApp/recommendations.py","position":61,"original_position":61,"commit_id":"7e7da5373ffc62c8bf37f59fc120f9b34afe6d7b","original_commit_id":"7e7da5373ffc62c8bf37f59fc120f9b34afe6d7b","user":{"login":"dorukkilitcioglu","id":9513119,"node_id":"MDQ6VXNlcjk1MTMxMTk=","avatar_url":"https://avatars2.githubusercontent.com/u/9513119?v=4","gravatar_id":"","url":"https://api.github.com/users/dorukkilitcioglu","html_url":"https://github.com/dorukkilitcioglu","followers_url":"https://api.github.com/users/dorukkilitcioglu/followers","following_url":"https://api.github.com/users/dorukkilitcioglu/following{/other_user}","gists_url":"https://api.github.com/users/dorukkilitcioglu/gists{/gist_id}","starred_url":"https://api.github.com/users/dorukkilitcioglu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dorukkilitcioglu/subscriptions","organizations_url":"https://api.github.com/users/dorukkilitcioglu/orgs","repos_url":"https://api.github.com/users/dorukkilitcioglu/repos","events_url":"https://api.github.com/users/dorukkilitcioglu/events{/privacy}","received_events_url":"https://api.github.com/users/dorukkilitcioglu/received_events","type":"User","site_admin":false},"body":"Can we change these to `p` and `Q`?","created_at":"2018-12-09T00:50:36Z","updated_at":"2018-12-09T00:56:20Z","html_url":"https://github.com/dorukkilitcioglu/books2rec/pull/28#discussion_r240020788","pull_request_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/28","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/comments/240020788"},"html":{"href":"https://github.com/dorukkilitcioglu/books2rec/pull/28#discussion_r240020788"},"pull_request":{"href":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/28","id":237099894,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3MDk5ODk0","html_url":"https://github.com/dorukkilitcioglu/books2rec/pull/28","diff_url":"https://github.com/dorukkilitcioglu/books2rec/pull/28.diff","patch_url":"https://github.com/dorukkilitcioglu/books2rec/pull/28.patch","issue_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/issues/28","number":28,"state":"open","locked":false,"title":"add partial fit to web app and use log ranking for hybrid user recs","user":{"login":"nickgreenquist","id":10702043,"node_id":"MDQ6VXNlcjEwNzAyMDQz","avatar_url":"https://avatars1.githubusercontent.com/u/10702043?v=4","gravatar_id":"","url":"https://api.github.com/users/nickgreenquist","html_url":"https://github.com/nickgreenquist","followers_url":"https://api.github.com/users/nickgreenquist/followers","following_url":"https://api.github.com/users/nickgreenquist/following{/other_user}","gists_url":"https://api.github.com/users/nickgreenquist/gists{/gist_id}","starred_url":"https://api.github.com/users/nickgreenquist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickgreenquist/subscriptions","organizations_url":"https://api.github.com/users/nickgreenquist/orgs","repos_url":"https://api.github.com/users/nickgreenquist/repos","events_url":"https://api.github.com/users/nickgreenquist/events{/privacy}","received_events_url":"https://api.github.com/users/nickgreenquist/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-09T00:29:21Z","updated_at":"2018-12-09T00:56:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7be3eb414b9bc77c9a1b29507c92a59811ed20db","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/28/commits","review_comments_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/28/comments","review_comment_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/issues/28/comments","statuses_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/statuses/7e7da5373ffc62c8bf37f59fc120f9b34afe6d7b","head":{"label":"dorukkilitcioglu:webapp_partial_fit","ref":"webapp_partial_fit","sha":"7e7da5373ffc62c8bf37f59fc120f9b34afe6d7b","user":{"login":"dorukkilitcioglu","id":9513119,"node_id":"MDQ6VXNlcjk1MTMxMTk=","avatar_url":"https://avatars2.githubusercontent.com/u/9513119?v=4","gravatar_id":"","url":"https://api.github.com/users/dorukkilitcioglu","html_url":"https://github.com/dorukkilitcioglu","followers_url":"https://api.github.com/users/dorukkilitcioglu/followers","following_url":"https://api.github.com/users/dorukkilitcioglu/following{/other_user}","gists_url":"https://api.github.com/users/dorukkilitcioglu/gists{/gist_id}","starred_url":"https://api.github.com/users/dorukkilitcioglu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dorukkilitcioglu/subscriptions","organizations_url":"https://api.github.com/users/dorukkilitcioglu/orgs","repos_url":"https://api.github.com/users/dorukkilitcioglu/repos","events_url":"https://api.github.com/users/dorukkilitcioglu/events{/privacy}","received_events_url":"https://api.github.com/users/dorukkilitcioglu/received_events","type":"User","site_admin":false},"repo":{"id":122852215,"node_id":"MDEwOlJlcG9zaXRvcnkxMjI4NTIyMTU=","name":"books2rec","full_name":"dorukkilitcioglu/books2rec","private":false,"owner":{"login":"dorukkilitcioglu","id":9513119,"node_id":"MDQ6VXNlcjk1MTMxMTk=","avatar_url":"https://avatars2.githubusercontent.com/u/9513119?v=4","gravatar_id":"","url":"https://api.github.com/users/dorukkilitcioglu","html_url":"https://github.com/dorukkilitcioglu","followers_url":"https://api.github.com/users/dorukkilitcioglu/followers","following_url":"https://api.github.com/users/dorukkilitcioglu/following{/other_user}","gists_url":"https://api.github.com/users/dorukkilitcioglu/gists{/gist_id}","starred_url":"https://api.github.com/users/dorukkilitcioglu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dorukkilitcioglu/subscriptions","organizations_url":"https://api.github.com/users/dorukkilitcioglu/orgs","repos_url":"https://api.github.com/users/dorukkilitcioglu/repos","events_url":"https://api.github.com/users/dorukkilitcioglu/events{/privacy}","received_events_url":"https://api.github.com/users/dorukkilitcioglu/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dorukkilitcioglu/books2rec","description":"A recommender system built for book lovers.","fork":false,"url":"https://api.github.com/repos/dorukkilitcioglu/books2rec","forks_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/forks","keys_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/teams","hooks_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/hooks","issue_events_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/issues/events{/number}","events_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/events","assignees_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/assignees{/user}","branches_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/branches{/branch}","tags_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/tags","blobs_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/git/refs{/sha}","trees_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/statuses/{sha}","languages_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/languages","stargazers_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/stargazers","contributors_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/contributors","subscribers_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/subscribers","subscription_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/subscription","commits_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/commits{/sha}","git_commits_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/git/commits{/sha}","comments_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/comments{/number}","issue_comment_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/issues/comments{/number}","contents_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/contents/{+path}","compare_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/merges","archive_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/downloads","issues_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/issues{/number}","pulls_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls{/number}","milestones_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/milestones{/number}","notifications_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/labels{/name}","releases_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/releases{/id}","deployments_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/deployments","created_at":"2018-02-25T16:12:18Z","updated_at":"2018-12-01T22:03:27Z","pushed_at":"2018-12-09T00:29:22Z","git_url":"git://github.com/dorukkilitcioglu/books2rec.git","ssh_url":"git@github.com:dorukkilitcioglu/books2rec.git","clone_url":"https://github.com/dorukkilitcioglu/books2rec.git","svn_url":"https://github.com/dorukkilitcioglu/books2rec","homepage":"https://books2rec.me","size":5258,"stargazers_count":22,"watchers_count":22,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":2,"open_issues":11,"watchers":22,"default_branch":"master"}},"base":{"label":"dorukkilitcioglu:master","ref":"master","sha":"6b4dd7d87a4b118c42f7614a78a00cbbf8f2798f","user":{"login":"dorukkilitcioglu","id":9513119,"node_id":"MDQ6VXNlcjk1MTMxMTk=","avatar_url":"https://avatars2.githubusercontent.com/u/9513119?v=4","gravatar_id":"","url":"https://api.github.com/users/dorukkilitcioglu","html_url":"https://github.com/dorukkilitcioglu","followers_url":"https://api.github.com/users/dorukkilitcioglu/followers","following_url":"https://api.github.com/users/dorukkilitcioglu/following{/other_user}","gists_url":"https://api.github.com/users/dorukkilitcioglu/gists{/gist_id}","starred_url":"https://api.github.com/users/dorukkilitcioglu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dorukkilitcioglu/subscriptions","organizations_url":"https://api.github.com/users/dorukkilitcioglu/orgs","repos_url":"https://api.github.com/users/dorukkilitcioglu/repos","events_url":"https://api.github.com/users/dorukkilitcioglu/events{/privacy}","received_events_url":"https://api.github.com/users/dorukkilitcioglu/received_events","type":"User","site_admin":false},"repo":{"id":122852215,"node_id":"MDEwOlJlcG9zaXRvcnkxMjI4NTIyMTU=","name":"books2rec","full_name":"dorukkilitcioglu/books2rec","private":false,"owner":{"login":"dorukkilitcioglu","id":9513119,"node_id":"MDQ6VXNlcjk1MTMxMTk=","avatar_url":"https://avatars2.githubusercontent.com/u/9513119?v=4","gravatar_id":"","url":"https://api.github.com/users/dorukkilitcioglu","html_url":"https://github.com/dorukkilitcioglu","followers_url":"https://api.github.com/users/dorukkilitcioglu/followers","following_url":"https://api.github.com/users/dorukkilitcioglu/following{/other_user}","gists_url":"https://api.github.com/users/dorukkilitcioglu/gists{/gist_id}","starred_url":"https://api.github.com/users/dorukkilitcioglu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dorukkilitcioglu/subscriptions","organizations_url":"https://api.github.com/users/dorukkilitcioglu/orgs","repos_url":"https://api.github.com/users/dorukkilitcioglu/repos","events_url":"https://api.github.com/users/dorukkilitcioglu/events{/privacy}","received_events_url":"https://api.github.com/users/dorukkilitcioglu/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dorukkilitcioglu/books2rec","description":"A recommender system built for book lovers.","fork":false,"url":"https://api.github.com/repos/dorukkilitcioglu/books2rec","forks_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/forks","keys_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/teams","hooks_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/hooks","issue_events_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/issues/events{/number}","events_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/events","assignees_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/assignees{/user}","branches_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/branches{/branch}","tags_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/tags","blobs_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/git/refs{/sha}","trees_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/statuses/{sha}","languages_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/languages","stargazers_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/stargazers","contributors_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/contributors","subscribers_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/subscribers","subscription_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/subscription","commits_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/commits{/sha}","git_commits_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/git/commits{/sha}","comments_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/comments{/number}","issue_comment_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/issues/comments{/number}","contents_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/contents/{+path}","compare_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/merges","archive_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/downloads","issues_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/issues{/number}","pulls_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls{/number}","milestones_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/milestones{/number}","notifications_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/labels{/name}","releases_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/releases{/id}","deployments_url":"https://api.github.com/repos/dorukkilitcioglu/books2rec/deployments","created_at":"2018-02-25T16:12:18Z","updated_at":"2018-12-01T22:03:27Z","pushed_at":"2018-12-09T00:29:22Z","git_url":"git://github.com/dorukkilitcioglu/books2rec.git","ssh_url":"git@github.com:dorukkilitcioglu/books2rec.git","clone_url":"https://github.com/dorukkilitcioglu/books2rec.git","svn_url":"https://github.com/dorukkilitcioglu/books2rec","homepage":"https://books2rec.me","size":5258,"stargazers_count":22,"watchers_count":22,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":2,"open_issues":11,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/28"},"html":{"href":"https://github.com/dorukkilitcioglu/books2rec/pull/28"},"issue":{"href":"https://api.github.com/repos/dorukkilitcioglu/books2rec/issues/28"},"comments":{"href":"https://api.github.com/repos/dorukkilitcioglu/books2rec/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dorukkilitcioglu/books2rec/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/dorukkilitcioglu/books2rec/statuses/7e7da5373ffc62c8bf37f59fc120f9b34afe6d7b"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"dorukkilitcioglu"}}