{"action":"created","comment":{"url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/comments/183507804","pull_request_review_id":114519464,"id":183507804,"diff_hunk":"@@ -635,6 +644,54 @@ def grid_search(self, prize_file, Gs, Bs, Ws):\n         return forest, augmented_forest, params_by_nodes\n \n \n+    def _eval_randomizations(self, params):\n+        \"\"\"\n+        Convenience method which sets parameters and performs PCSF\n+        \"\"\"\n+\n+        self._reset_hyperparameters(params)\n+        paramstring = \"G_{}_B_{}_W_{}\".format(*[int(x) if int(x) == x else x for x in [params['g'], params['b'], params['w']]])\n+        logger.info(\"Randomizations for \" + paramstring)\n+\n+        forest, augmented_forest = self.randomizations(params[\"noisy_edges_repetitions\"], params[\"random_terminals_repetitions\"])\n+        \n+        return paramstring, forest, augmented_forest\n+\n+\n+    def _grid_randomization(self, prize_file, params):\n+        \"\"\"\n+        Internal function which executes pcsf at every point in a parameter grid.\n+        Subroutine of `grid_search`.\n+\n+        Arguments:\n+            prize_file (str): filepath\n+            params (dict): params with which to run the program\n+\n+        Returns:\n+            results (dict)\n+        \"\"\"\n+\n+        # get number of cpus available to job\n+        try:\n+            n_cpus = int(os.environ[\"SLURM_JOB_CPUS_PER_NODE\"])\n+        except KeyError:\n+            n_cpus = multiprocessing.cpu_count()\n+\n+        pool = multiprocessing.Pool(n_cpus)\n+\n+        self.prepare_prizes(prize_file)\n+\n+        model_params = [{'w': w, 'b': b, 'g':g} for (w, b, g) in product(params['w'], params['b'], params['g'])]\n+        other_params = {key: params[key] for key in params if key not in 'wbg'} # `not in 'wbg'` is a shortened way of writing `key != 'w' & key != 'b' & key != 'g'`\n+        all_params = [{**model_param, **other_params} for model_param in model_params]","path":"src/graph.py","position":null,"original_position":77,"commit_id":"fe6e13ad29018b368cf28bd2fa455ccf8179a90e","original_commit_id":"286ee2bc9e04005412577b052963c3c9226e7275","user":{"login":"iamjli","id":7219365,"avatar_url":"https://avatars1.githubusercontent.com/u/7219365?v=4","gravatar_id":"","url":"https://api.github.com/users/iamjli","html_url":"https://github.com/iamjli","followers_url":"https://api.github.com/users/iamjli/followers","following_url":"https://api.github.com/users/iamjli/following{/other_user}","gists_url":"https://api.github.com/users/iamjli/gists{/gist_id}","starred_url":"https://api.github.com/users/iamjli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamjli/subscriptions","organizations_url":"https://api.github.com/users/iamjli/orgs","repos_url":"https://api.github.com/users/iamjli/repos","events_url":"https://api.github.com/users/iamjli/events{/privacy}","received_events_url":"https://api.github.com/users/iamjli/received_events","type":"User","site_admin":false},"body":"fe6e13ad29018b368cf28bd2fa455ccf8179a90e","created_at":"2018-04-23T19:16:19Z","updated_at":"2018-04-23T19:16:19Z","html_url":"https://github.com/fraenkel-lab/OmicsIntegrator2/pull/72#discussion_r183507804","pull_request_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/72","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/comments/183507804"},"html":{"href":"https://github.com/fraenkel-lab/OmicsIntegrator2/pull/72#discussion_r183507804"},"pull_request":{"href":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/72"}},"in_reply_to_id":183258902},"pull_request":{"url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/72","id":182313391,"html_url":"https://github.com/fraenkel-lab/OmicsIntegrator2/pull/72","diff_url":"https://github.com/fraenkel-lab/OmicsIntegrator2/pull/72.diff","patch_url":"https://github.com/fraenkel-lab/OmicsIntegrator2/pull/72.patch","issue_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/issues/72","number":72,"state":"open","locked":false,"title":"Grid randomizations","user":{"login":"iamjli","id":7219365,"avatar_url":"https://avatars1.githubusercontent.com/u/7219365?v=4","gravatar_id":"","url":"https://api.github.com/users/iamjli","html_url":"https://github.com/iamjli","followers_url":"https://api.github.com/users/iamjli/followers","following_url":"https://api.github.com/users/iamjli/following{/other_user}","gists_url":"https://api.github.com/users/iamjli/gists{/gist_id}","starred_url":"https://api.github.com/users/iamjli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamjli/subscriptions","organizations_url":"https://api.github.com/users/iamjli/orgs","repos_url":"https://api.github.com/users/iamjli/repos","events_url":"https://api.github.com/users/iamjli/events{/privacy}","received_events_url":"https://api.github.com/users/iamjli/received_events","type":"User","site_admin":false},"body":"Wrote an example notebook to cleanly perform the first 2 steps of omics integration. Also added R visualization directly to the notebook.\r\n\r\nAdded grid search for randomization experiments. In fact, the new function `_grid_randomization` is a generalization of `grid_search`. ","created_at":"2018-04-17T21:47:51Z","updated_at":"2018-04-23T19:16:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8e3be4e8c6fcdbb2798e583ca18e5314a7282d9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/72/commits","review_comments_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/72/comments","review_comment_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/issues/72/comments","statuses_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/statuses/fe6e13ad29018b368cf28bd2fa455ccf8179a90e","head":{"label":"fraenkel-lab:grid_randomizations","ref":"grid_randomizations","sha":"fe6e13ad29018b368cf28bd2fa455ccf8179a90e","user":{"login":"fraenkel-lab","id":18214161,"avatar_url":"https://avatars3.githubusercontent.com/u/18214161?v=4","gravatar_id":"","url":"https://api.github.com/users/fraenkel-lab","html_url":"https://github.com/fraenkel-lab","followers_url":"https://api.github.com/users/fraenkel-lab/followers","following_url":"https://api.github.com/users/fraenkel-lab/following{/other_user}","gists_url":"https://api.github.com/users/fraenkel-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/fraenkel-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fraenkel-lab/subscriptions","organizations_url":"https://api.github.com/users/fraenkel-lab/orgs","repos_url":"https://api.github.com/users/fraenkel-lab/repos","events_url":"https://api.github.com/users/fraenkel-lab/events{/privacy}","received_events_url":"https://api.github.com/users/fraenkel-lab/received_events","type":"Organization","site_admin":false},"repo":{"id":81354628,"name":"OmicsIntegrator2","full_name":"fraenkel-lab/OmicsIntegrator2","owner":{"login":"fraenkel-lab","id":18214161,"avatar_url":"https://avatars3.githubusercontent.com/u/18214161?v=4","gravatar_id":"","url":"https://api.github.com/users/fraenkel-lab","html_url":"https://github.com/fraenkel-lab","followers_url":"https://api.github.com/users/fraenkel-lab/followers","following_url":"https://api.github.com/users/fraenkel-lab/following{/other_user}","gists_url":"https://api.github.com/users/fraenkel-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/fraenkel-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fraenkel-lab/subscriptions","organizations_url":"https://api.github.com/users/fraenkel-lab/orgs","repos_url":"https://api.github.com/users/fraenkel-lab/repos","events_url":"https://api.github.com/users/fraenkel-lab/events{/privacy}","received_events_url":"https://api.github.com/users/fraenkel-lab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fraenkel-lab/OmicsIntegrator2","description":"Convenient Prize-Collecting Steiner Forests for Interactomes","fork":false,"url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2","forks_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/forks","keys_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/teams","hooks_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/hooks","issue_events_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/issues/events{/number}","events_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/events","assignees_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/assignees{/user}","branches_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/branches{/branch}","tags_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/tags","blobs_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/git/refs{/sha}","trees_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/statuses/{sha}","languages_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/languages","stargazers_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/stargazers","contributors_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/contributors","subscribers_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/subscribers","subscription_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/subscription","commits_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/commits{/sha}","git_commits_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/git/commits{/sha}","comments_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/comments{/number}","issue_comment_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/issues/comments{/number}","contents_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/contents/{+path}","compare_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/merges","archive_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/downloads","issues_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/issues{/number}","pulls_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls{/number}","milestones_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/milestones{/number}","notifications_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/labels{/name}","releases_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/releases{/id}","deployments_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/deployments","created_at":"2017-02-08T17:11:12Z","updated_at":"2018-04-21T08:50:52Z","pushed_at":"2018-04-23T19:16:13Z","git_url":"git://github.com/fraenkel-lab/OmicsIntegrator2.git","ssh_url":"git@github.com:fraenkel-lab/OmicsIntegrator2.git","clone_url":"https://github.com/fraenkel-lab/OmicsIntegrator2.git","svn_url":"https://github.com/fraenkel-lab/OmicsIntegrator2","homepage":"https://fraenkel-lab.github.io/OmicsIntegrator2","size":18864,"stargazers_count":6,"watchers_count":6,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":13,"license":null,"forks":1,"open_issues":13,"watchers":6,"default_branch":"master"}},"base":{"label":"fraenkel-lab:master","ref":"master","sha":"0e03248a73acdc45acd817fe951f39c3bdd3b395","user":{"login":"fraenkel-lab","id":18214161,"avatar_url":"https://avatars3.githubusercontent.com/u/18214161?v=4","gravatar_id":"","url":"https://api.github.com/users/fraenkel-lab","html_url":"https://github.com/fraenkel-lab","followers_url":"https://api.github.com/users/fraenkel-lab/followers","following_url":"https://api.github.com/users/fraenkel-lab/following{/other_user}","gists_url":"https://api.github.com/users/fraenkel-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/fraenkel-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fraenkel-lab/subscriptions","organizations_url":"https://api.github.com/users/fraenkel-lab/orgs","repos_url":"https://api.github.com/users/fraenkel-lab/repos","events_url":"https://api.github.com/users/fraenkel-lab/events{/privacy}","received_events_url":"https://api.github.com/users/fraenkel-lab/received_events","type":"Organization","site_admin":false},"repo":{"id":81354628,"name":"OmicsIntegrator2","full_name":"fraenkel-lab/OmicsIntegrator2","owner":{"login":"fraenkel-lab","id":18214161,"avatar_url":"https://avatars3.githubusercontent.com/u/18214161?v=4","gravatar_id":"","url":"https://api.github.com/users/fraenkel-lab","html_url":"https://github.com/fraenkel-lab","followers_url":"https://api.github.com/users/fraenkel-lab/followers","following_url":"https://api.github.com/users/fraenkel-lab/following{/other_user}","gists_url":"https://api.github.com/users/fraenkel-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/fraenkel-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fraenkel-lab/subscriptions","organizations_url":"https://api.github.com/users/fraenkel-lab/orgs","repos_url":"https://api.github.com/users/fraenkel-lab/repos","events_url":"https://api.github.com/users/fraenkel-lab/events{/privacy}","received_events_url":"https://api.github.com/users/fraenkel-lab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fraenkel-lab/OmicsIntegrator2","description":"Convenient Prize-Collecting Steiner Forests for Interactomes","fork":false,"url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2","forks_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/forks","keys_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/teams","hooks_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/hooks","issue_events_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/issues/events{/number}","events_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/events","assignees_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/assignees{/user}","branches_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/branches{/branch}","tags_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/tags","blobs_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/git/refs{/sha}","trees_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/statuses/{sha}","languages_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/languages","stargazers_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/stargazers","contributors_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/contributors","subscribers_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/subscribers","subscription_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/subscription","commits_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/commits{/sha}","git_commits_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/git/commits{/sha}","comments_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/comments{/number}","issue_comment_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/issues/comments{/number}","contents_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/contents/{+path}","compare_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/merges","archive_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/downloads","issues_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/issues{/number}","pulls_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls{/number}","milestones_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/milestones{/number}","notifications_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/labels{/name}","releases_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/releases{/id}","deployments_url":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/deployments","created_at":"2017-02-08T17:11:12Z","updated_at":"2018-04-21T08:50:52Z","pushed_at":"2018-04-23T19:16:13Z","git_url":"git://github.com/fraenkel-lab/OmicsIntegrator2.git","ssh_url":"git@github.com:fraenkel-lab/OmicsIntegrator2.git","clone_url":"https://github.com/fraenkel-lab/OmicsIntegrator2.git","svn_url":"https://github.com/fraenkel-lab/OmicsIntegrator2","homepage":"https://fraenkel-lab.github.io/OmicsIntegrator2","size":18864,"stargazers_count":6,"watchers_count":6,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":13,"license":null,"forks":1,"open_issues":13,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/72"},"html":{"href":"https://github.com/fraenkel-lab/OmicsIntegrator2/pull/72"},"issue":{"href":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/issues/72"},"comments":{"href":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/issues/72/comments"},"review_comments":{"href":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/72/comments"},"review_comment":{"href":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/pulls/72/commits"},"statuses":{"href":"https://api.github.com/repos/fraenkel-lab/OmicsIntegrator2/statuses/fe6e13ad29018b368cf28bd2fa455ccf8179a90e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"iamjli"}}