{"action":"created","comment":{"url":"https://api.github.com/repos/PRMLmasters/PRML/pulls/comments/179950415","pull_request_review_id":110290065,"id":179950415,"diff_hunk":"@@ -1,6 +1,41 @@\n import numpy as np\n \n \n-def integral(_func, start, end, n_split=500):\n+def integral(_func, start, end, n_split=500, args=None):\n     interval = (end - start) / n_split\n-    return sum([_func(i)*interval for i in np.linspace(start, end, n_split)])\n+    return sum([_func(i)*interval for i in np.linspace(\n+        start, end, n_split)]) if args is None else \\\n+            sum([_func(i,*args)*interval for i in np.linspace(\n+                start, end, n_split)])\n+\n+#範囲の引数が無限の時に,有限の値になるように制限\n+def limit_inf(num, limit=1000):\n+    if not np.isinf(num):\n+        return num\n+    else:\n+        return limit if num > 0 else -limit\n+    \n+def n_dimension_integral(_func, ranges, n_split=500, args=None):\n+    \"\"\"\n+    ranges...([low,high],[low,high],...)\n+    \"\"\"\n+    ranges = tuple(list(map(limit_inf ,_range)) for _range in ranges)\n+    interval = np.prod([(_range[1] - _range[0])/ n_split for _range in ranges], axis=0)\n+    ranges = tuple(list(map(lambda x: np.linspace(*x, n_split), ranges)))\n+    combinations = np.asarray([_range.ravel() for _range in np.meshgrid(*ranges)]).T\n+    return sum([_func(*combi,*args)*interval for combi in combinations]) \\","path":"impl/utils/function.py","position":28,"original_position":28,"commit_id":"03729b9968f8a3628a15e3782d52e18ac2be22b5","original_commit_id":"03729b9968f8a3628a15e3782d52e18ac2be22b5","user":{"login":"yuto-kakitani","id":30789076,"avatar_url":"https://avatars2.githubusercontent.com/u/30789076?v=4","gravatar_id":"","url":"https://api.github.com/users/yuto-kakitani","html_url":"https://github.com/yuto-kakitani","followers_url":"https://api.github.com/users/yuto-kakitani/followers","following_url":"https://api.github.com/users/yuto-kakitani/following{/other_user}","gists_url":"https://api.github.com/users/yuto-kakitani/gists{/gist_id}","starred_url":"https://api.github.com/users/yuto-kakitani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuto-kakitani/subscriptions","organizations_url":"https://api.github.com/users/yuto-kakitani/orgs","repos_url":"https://api.github.com/users/yuto-kakitani/repos","events_url":"https://api.github.com/users/yuto-kakitani/events{/privacy}","received_events_url":"https://api.github.com/users/yuto-kakitani/received_events","type":"User","site_admin":false},"body":"了解しました\r\n今のところjupyterで実行してみて確認しただけなので、計算量とかメモリの使用量をもうちょいちゃんと計算してissueにあげてみますね","created_at":"2018-04-08T14:55:50Z","updated_at":"2018-04-08T14:57:47Z","html_url":"https://github.com/PRMLmasters/PRML/pull/12#discussion_r179950415","pull_request_url":"https://api.github.com/repos/PRMLmasters/PRML/pulls/12","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/PRMLmasters/PRML/pulls/comments/179950415"},"html":{"href":"https://github.com/PRMLmasters/PRML/pull/12#discussion_r179950415"},"pull_request":{"href":"https://api.github.com/repos/PRMLmasters/PRML/pulls/12"}},"in_reply_to_id":179741496},"pull_request":{"url":"https://api.github.com/repos/PRMLmasters/PRML/pulls/12","id":179855630,"html_url":"https://github.com/PRMLmasters/PRML/pull/12","diff_url":"https://github.com/PRMLmasters/PRML/pull/12.diff","patch_url":"https://github.com/PRMLmasters/PRML/pull/12.patch","issue_url":"https://api.github.com/repos/PRMLmasters/PRML/issues/12","number":12,"state":"open","locked":false,"title":"Improve integral","user":{"login":"masakicktashiro","id":32268492,"avatar_url":"https://avatars0.githubusercontent.com/u/32268492?v=4","gravatar_id":"","url":"https://api.github.com/users/masakicktashiro","html_url":"https://github.com/masakicktashiro","followers_url":"https://api.github.com/users/masakicktashiro/followers","following_url":"https://api.github.com/users/masakicktashiro/following{/other_user}","gists_url":"https://api.github.com/users/masakicktashiro/gists{/gist_id}","starred_url":"https://api.github.com/users/masakicktashiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masakicktashiro/subscriptions","organizations_url":"https://api.github.com/users/masakicktashiro/orgs","repos_url":"https://api.github.com/users/masakicktashiro/repos","events_url":"https://api.github.com/users/masakicktashiro/events{/privacy}","received_events_url":"https://api.github.com/users/masakicktashiro/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-06T05:08:11Z","updated_at":"2018-04-08T14:57:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f98eef777276b23d3b98e5f779b7479ba9bf0cd","assignee":null,"assignees":[],"requested_reviewers":[{"login":"Resesh","id":32260606,"avatar_url":"https://avatars0.githubusercontent.com/u/32260606?v=4","gravatar_id":"","url":"https://api.github.com/users/Resesh","html_url":"https://github.com/Resesh","followers_url":"https://api.github.com/users/Resesh/followers","following_url":"https://api.github.com/users/Resesh/following{/other_user}","gists_url":"https://api.github.com/users/Resesh/gists{/gist_id}","starred_url":"https://api.github.com/users/Resesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Resesh/subscriptions","organizations_url":"https://api.github.com/users/Resesh/orgs","repos_url":"https://api.github.com/users/Resesh/repos","events_url":"https://api.github.com/users/Resesh/events{/privacy}","received_events_url":"https://api.github.com/users/Resesh/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/PRMLmasters/PRML/pulls/12/commits","review_comments_url":"https://api.github.com/repos/PRMLmasters/PRML/pulls/12/comments","review_comment_url":"https://api.github.com/repos/PRMLmasters/PRML/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PRMLmasters/PRML/issues/12/comments","statuses_url":"https://api.github.com/repos/PRMLmasters/PRML/statuses/03729b9968f8a3628a15e3782d52e18ac2be22b5","head":{"label":"PRMLmasters:improve_integral","ref":"improve_integral","sha":"03729b9968f8a3628a15e3782d52e18ac2be22b5","user":{"login":"PRMLmasters","id":37608038,"avatar_url":"https://avatars2.githubusercontent.com/u/37608038?v=4","gravatar_id":"","url":"https://api.github.com/users/PRMLmasters","html_url":"https://github.com/PRMLmasters","followers_url":"https://api.github.com/users/PRMLmasters/followers","following_url":"https://api.github.com/users/PRMLmasters/following{/other_user}","gists_url":"https://api.github.com/users/PRMLmasters/gists{/gist_id}","starred_url":"https://api.github.com/users/PRMLmasters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PRMLmasters/subscriptions","organizations_url":"https://api.github.com/users/PRMLmasters/orgs","repos_url":"https://api.github.com/users/PRMLmasters/repos","events_url":"https://api.github.com/users/PRMLmasters/events{/privacy}","received_events_url":"https://api.github.com/users/PRMLmasters/received_events","type":"Organization","site_admin":false},"repo":{"id":126122966,"name":"PRML","full_name":"PRMLmasters/PRML","owner":{"login":"PRMLmasters","id":37608038,"avatar_url":"https://avatars2.githubusercontent.com/u/37608038?v=4","gravatar_id":"","url":"https://api.github.com/users/PRMLmasters","html_url":"https://github.com/PRMLmasters","followers_url":"https://api.github.com/users/PRMLmasters/followers","following_url":"https://api.github.com/users/PRMLmasters/following{/other_user}","gists_url":"https://api.github.com/users/PRMLmasters/gists{/gist_id}","starred_url":"https://api.github.com/users/PRMLmasters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PRMLmasters/subscriptions","organizations_url":"https://api.github.com/users/PRMLmasters/orgs","repos_url":"https://api.github.com/users/PRMLmasters/repos","events_url":"https://api.github.com/users/PRMLmasters/events{/privacy}","received_events_url":"https://api.github.com/users/PRMLmasters/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PRMLmasters/PRML","description":" implement algorithms in PRML","fork":false,"url":"https://api.github.com/repos/PRMLmasters/PRML","forks_url":"https://api.github.com/repos/PRMLmasters/PRML/forks","keys_url":"https://api.github.com/repos/PRMLmasters/PRML/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PRMLmasters/PRML/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PRMLmasters/PRML/teams","hooks_url":"https://api.github.com/repos/PRMLmasters/PRML/hooks","issue_events_url":"https://api.github.com/repos/PRMLmasters/PRML/issues/events{/number}","events_url":"https://api.github.com/repos/PRMLmasters/PRML/events","assignees_url":"https://api.github.com/repos/PRMLmasters/PRML/assignees{/user}","branches_url":"https://api.github.com/repos/PRMLmasters/PRML/branches{/branch}","tags_url":"https://api.github.com/repos/PRMLmasters/PRML/tags","blobs_url":"https://api.github.com/repos/PRMLmasters/PRML/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PRMLmasters/PRML/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PRMLmasters/PRML/git/refs{/sha}","trees_url":"https://api.github.com/repos/PRMLmasters/PRML/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PRMLmasters/PRML/statuses/{sha}","languages_url":"https://api.github.com/repos/PRMLmasters/PRML/languages","stargazers_url":"https://api.github.com/repos/PRMLmasters/PRML/stargazers","contributors_url":"https://api.github.com/repos/PRMLmasters/PRML/contributors","subscribers_url":"https://api.github.com/repos/PRMLmasters/PRML/subscribers","subscription_url":"https://api.github.com/repos/PRMLmasters/PRML/subscription","commits_url":"https://api.github.com/repos/PRMLmasters/PRML/commits{/sha}","git_commits_url":"https://api.github.com/repos/PRMLmasters/PRML/git/commits{/sha}","comments_url":"https://api.github.com/repos/PRMLmasters/PRML/comments{/number}","issue_comment_url":"https://api.github.com/repos/PRMLmasters/PRML/issues/comments{/number}","contents_url":"https://api.github.com/repos/PRMLmasters/PRML/contents/{+path}","compare_url":"https://api.github.com/repos/PRMLmasters/PRML/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PRMLmasters/PRML/merges","archive_url":"https://api.github.com/repos/PRMLmasters/PRML/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PRMLmasters/PRML/downloads","issues_url":"https://api.github.com/repos/PRMLmasters/PRML/issues{/number}","pulls_url":"https://api.github.com/repos/PRMLmasters/PRML/pulls{/number}","milestones_url":"https://api.github.com/repos/PRMLmasters/PRML/milestones{/number}","notifications_url":"https://api.github.com/repos/PRMLmasters/PRML/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PRMLmasters/PRML/labels{/name}","releases_url":"https://api.github.com/repos/PRMLmasters/PRML/releases{/id}","deployments_url":"https://api.github.com/repos/PRMLmasters/PRML/deployments","created_at":"2018-03-21T04:24:48Z","updated_at":"2018-04-05T01:46:33Z","pushed_at":"2018-04-08T06:23:50Z","git_url":"git://github.com/PRMLmasters/PRML.git","ssh_url":"git@github.com:PRMLmasters/PRML.git","clone_url":"https://github.com/PRMLmasters/PRML.git","svn_url":"https://github.com/PRMLmasters/PRML","homepage":null,"size":19,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"PRMLmasters:master","ref":"master","sha":"b044e94a7b4f98418fff9ce7fa8d6ff68387921b","user":{"login":"PRMLmasters","id":37608038,"avatar_url":"https://avatars2.githubusercontent.com/u/37608038?v=4","gravatar_id":"","url":"https://api.github.com/users/PRMLmasters","html_url":"https://github.com/PRMLmasters","followers_url":"https://api.github.com/users/PRMLmasters/followers","following_url":"https://api.github.com/users/PRMLmasters/following{/other_user}","gists_url":"https://api.github.com/users/PRMLmasters/gists{/gist_id}","starred_url":"https://api.github.com/users/PRMLmasters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PRMLmasters/subscriptions","organizations_url":"https://api.github.com/users/PRMLmasters/orgs","repos_url":"https://api.github.com/users/PRMLmasters/repos","events_url":"https://api.github.com/users/PRMLmasters/events{/privacy}","received_events_url":"https://api.github.com/users/PRMLmasters/received_events","type":"Organization","site_admin":false},"repo":{"id":126122966,"name":"PRML","full_name":"PRMLmasters/PRML","owner":{"login":"PRMLmasters","id":37608038,"avatar_url":"https://avatars2.githubusercontent.com/u/37608038?v=4","gravatar_id":"","url":"https://api.github.com/users/PRMLmasters","html_url":"https://github.com/PRMLmasters","followers_url":"https://api.github.com/users/PRMLmasters/followers","following_url":"https://api.github.com/users/PRMLmasters/following{/other_user}","gists_url":"https://api.github.com/users/PRMLmasters/gists{/gist_id}","starred_url":"https://api.github.com/users/PRMLmasters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PRMLmasters/subscriptions","organizations_url":"https://api.github.com/users/PRMLmasters/orgs","repos_url":"https://api.github.com/users/PRMLmasters/repos","events_url":"https://api.github.com/users/PRMLmasters/events{/privacy}","received_events_url":"https://api.github.com/users/PRMLmasters/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PRMLmasters/PRML","description":" implement algorithms in PRML","fork":false,"url":"https://api.github.com/repos/PRMLmasters/PRML","forks_url":"https://api.github.com/repos/PRMLmasters/PRML/forks","keys_url":"https://api.github.com/repos/PRMLmasters/PRML/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PRMLmasters/PRML/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PRMLmasters/PRML/teams","hooks_url":"https://api.github.com/repos/PRMLmasters/PRML/hooks","issue_events_url":"https://api.github.com/repos/PRMLmasters/PRML/issues/events{/number}","events_url":"https://api.github.com/repos/PRMLmasters/PRML/events","assignees_url":"https://api.github.com/repos/PRMLmasters/PRML/assignees{/user}","branches_url":"https://api.github.com/repos/PRMLmasters/PRML/branches{/branch}","tags_url":"https://api.github.com/repos/PRMLmasters/PRML/tags","blobs_url":"https://api.github.com/repos/PRMLmasters/PRML/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PRMLmasters/PRML/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PRMLmasters/PRML/git/refs{/sha}","trees_url":"https://api.github.com/repos/PRMLmasters/PRML/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PRMLmasters/PRML/statuses/{sha}","languages_url":"https://api.github.com/repos/PRMLmasters/PRML/languages","stargazers_url":"https://api.github.com/repos/PRMLmasters/PRML/stargazers","contributors_url":"https://api.github.com/repos/PRMLmasters/PRML/contributors","subscribers_url":"https://api.github.com/repos/PRMLmasters/PRML/subscribers","subscription_url":"https://api.github.com/repos/PRMLmasters/PRML/subscription","commits_url":"https://api.github.com/repos/PRMLmasters/PRML/commits{/sha}","git_commits_url":"https://api.github.com/repos/PRMLmasters/PRML/git/commits{/sha}","comments_url":"https://api.github.com/repos/PRMLmasters/PRML/comments{/number}","issue_comment_url":"https://api.github.com/repos/PRMLmasters/PRML/issues/comments{/number}","contents_url":"https://api.github.com/repos/PRMLmasters/PRML/contents/{+path}","compare_url":"https://api.github.com/repos/PRMLmasters/PRML/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PRMLmasters/PRML/merges","archive_url":"https://api.github.com/repos/PRMLmasters/PRML/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PRMLmasters/PRML/downloads","issues_url":"https://api.github.com/repos/PRMLmasters/PRML/issues{/number}","pulls_url":"https://api.github.com/repos/PRMLmasters/PRML/pulls{/number}","milestones_url":"https://api.github.com/repos/PRMLmasters/PRML/milestones{/number}","notifications_url":"https://api.github.com/repos/PRMLmasters/PRML/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PRMLmasters/PRML/labels{/name}","releases_url":"https://api.github.com/repos/PRMLmasters/PRML/releases{/id}","deployments_url":"https://api.github.com/repos/PRMLmasters/PRML/deployments","created_at":"2018-03-21T04:24:48Z","updated_at":"2018-04-05T01:46:33Z","pushed_at":"2018-04-08T06:23:50Z","git_url":"git://github.com/PRMLmasters/PRML.git","ssh_url":"git@github.com:PRMLmasters/PRML.git","clone_url":"https://github.com/PRMLmasters/PRML.git","svn_url":"https://github.com/PRMLmasters/PRML","homepage":null,"size":19,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PRMLmasters/PRML/pulls/12"},"html":{"href":"https://github.com/PRMLmasters/PRML/pull/12"},"issue":{"href":"https://api.github.com/repos/PRMLmasters/PRML/issues/12"},"comments":{"href":"https://api.github.com/repos/PRMLmasters/PRML/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/PRMLmasters/PRML/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/PRMLmasters/PRML/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PRMLmasters/PRML/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/PRMLmasters/PRML/statuses/03729b9968f8a3628a15e3782d52e18ac2be22b5"}},"author_association":"NONE"}}
{"actor":{"display_login":"yuto-kakitani"}}