payload: {"action":"opened","number":14,"pull_request":{"url":"https://api.github.com/repos/deepcharles/ruptures/pulls/14","id":332441261,"node_id":"MDExOlB1bGxSZXF1ZXN0MzMyNDQxMjYx","html_url":"https://github.com/deepcharles/ruptures/pull/14","diff_url":"https://github.com/deepcharles/ruptures/pull/14.diff","patch_url":"https://github.com/deepcharles/ruptures/pull/14.patch","issue_url":"https://api.github.com/repos/deepcharles/ruptures/issues/14","number":14,"state":"open","locked":false,"title":"Weird behaviour correction when median(K) = 0","user":{"login":"guillaumeGilles98","id":56997675,"node_id":"MDQ6VXNlcjU2OTk3Njc1","avatar_url":"https://avatars1.githubusercontent.com/u/56997675?v=4","gravatar_id":"","url":"https://api.github.com/users/guillaumeGilles98","html_url":"https://github.com/guillaumeGilles98","followers_url":"https://api.github.com/users/guillaumeGilles98/followers","following_url":"https://api.github.com/users/guillaumeGilles98/following{/other_user}","gists_url":"https://api.github.com/users/guillaumeGilles98/gists{/gist_id}","starred_url":"https://api.github.com/users/guillaumeGilles98/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guillaumeGilles98/subscriptions","organizations_url":"https://api.github.com/users/guillaumeGilles98/orgs","repos_url":"https://api.github.com/users/guillaumeGilles98/repos","events_url":"https://api.github.com/users/guillaumeGilles98/events{/privacy}","received_events_url":"https://api.github.com/users/guillaumeGilles98/received_events","type":"User","site_admin":false},"body":"During some different tests, we experiment a weird behaviour with PELT (RBF cost function) \r\nWhen median(K) is equal to 0, the  segmentation is clearly weird : each segment have an equal length (5).\r\n\r\nTo experiment this you can run the following code \r\n```python\r\nimport ruptures\r\nimport numpy as np\r\ncurve= [0, 528, 503, 0, 0, 0, 541, 542, 0, 542, 0, 0, 0, 542, \r\n             500, 530, 0, 0, 515, 0, 536, 0, 0, 539, 518, 0, 0, 530, 0, 0, \r\n             503, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \r\n             0, 0, 0]\r\ncurve = np.array(curve)\r\nalgo = ruptures.Pelt(model='rbf', min_size=1).fit(curve)\r\nseg = algo.predict(pen=1)\r\nruptures.display(curve, seg)\r\n```\r\nWhich leads to this segmentation : \r\n![rupture_error_segmentation](https://user-images.githubusercontent.com/56997675/67561735-aec88580-f71d-11e9-9980-6ceee9a15c10.png)\r\n\r\nWe basically corrected this error by not dividing if the median is 0.\r\nWe are not sure about what this correction implies mathematically speaking but with such correction we obtain this result which seems clearly better :\r\n![rupture_seg](https://user-images.githubusercontent.com/56997675/67562410-ef74ce80-f71e-11e9-81f3-34766802ae12.png)\r\n","created_at":"2019-10-25T10:15:19Z","updated_at":"2019-10-25T10:15:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/deepcharles/ruptures/pulls/14/commits","review_comments_url":"https://api.github.com/repos/deepcharles/ruptures/pulls/14/comments","review_comment_url":"https://api.github.com/repos/deepcharles/ruptures/pulls/comments{/number}","comments_url":"https://api.github.com/repos/deepcharles/ruptures/issues/14/comments","statuses_url":"https://api.github.com/repos/deepcharles/ruptures/statuses/0bbceb220cafc2b48e880c217d09caf33353b679","head":{"label":"guillaumeGilles98:master","ref":"master","sha":"0bbceb220cafc2b48e880c217d09caf33353b679","user":{"login":"guillaumeGilles98","id":56997675,"node_id":"MDQ6VXNlcjU2OTk3Njc1","avatar_url":"https://avatars1.githubusercontent.com/u/56997675?v=4","gravatar_id":"","url":"https://api.github.com/users/guillaumeGilles98","html_url":"https://github.com/guillaumeGilles98","followers_url":"https://api.github.com/users/guillaumeGilles98/followers","following_url":"https://api.github.com/users/guillaumeGilles98/following{/other_user}","gists_url":"https://api.github.com/users/guillaumeGilles98/gists{/gist_id}","starred_url":"https://api.github.com/users/guillaumeGilles98/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guillaumeGilles98/subscriptions","organizations_url":"https://api.github.com/users/guillaumeGilles98/orgs","repos_url":"https://api.github.com/users/guillaumeGilles98/repos","events_url":"https://api.github.com/users/guillaumeGilles98/events{/privacy}","received_events_url":"https://api.github.com/users/guillaumeGilles98/received_events","type":"User","site_admin":false},"repo":{"id":217493940,"node_id":"MDEwOlJlcG9zaXRvcnkyMTc0OTM5NDA=","name":"ruptures","full_name":"guillaumeGilles98/ruptures","private":false,"owner":{"login":"guillaumeGilles98","id":56997675,"node_id":"MDQ6VXNlcjU2OTk3Njc1","avatar_url":"https://avatars1.githubusercontent.com/u/56997675?v=4","gravatar_id":"","url":"https://api.github.com/users/guillaumeGilles98","html_url":"https://github.com/guillaumeGilles98","followers_url":"https://api.github.com/users/guillaumeGilles98/followers","following_url":"https://api.github.com/users/guillaumeGilles98/following{/other_user}","gists_url":"https://api.github.com/users/guillaumeGilles98/gists{/gist_id}","starred_url":"https://api.github.com/users/guillaumeGilles98/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guillaumeGilles98/subscriptions","organizations_url":"https://api.github.com/users/guillaumeGilles98/orgs","repos_url":"https://api.github.com/users/guillaumeGilles98/repos","events_url":"https://api.github.com/users/guillaumeGilles98/events{/privacy}","received_events_url":"https://api.github.com/users/guillaumeGilles98/received_events","type":"User","site_admin":false},"html_url":"https://github.com/guillaumeGilles98/ruptures","description":"ruptures: change point detection in Python","fork":true,"url":"https://api.github.com/repos/guillaumeGilles98/ruptures","forks_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/forks","keys_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/teams","hooks_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/hooks","issue_events_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/issues/events{/number}","events_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/events","assignees_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/assignees{/user}","branches_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/branches{/branch}","tags_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/tags","blobs_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/git/refs{/sha}","trees_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/statuses/{sha}","languages_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/languages","stargazers_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/stargazers","contributors_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/contributors","subscribers_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/subscribers","subscription_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/subscription","commits_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/commits{/sha}","git_commits_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/git/commits{/sha}","comments_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/comments{/number}","issue_comment_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/issues/comments{/number}","contents_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/contents/{+path}","compare_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/merges","archive_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/downloads","issues_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/issues{/number}","pulls_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/pulls{/number}","milestones_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/milestones{/number}","notifications_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/labels{/name}","releases_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/releases{/id}","deployments_url":"https://api.github.com/repos/guillaumeGilles98/ruptures/deployments","created_at":"2019-10-25T08:58:38Z","updated_at":"2019-10-25T09:45:42Z","pushed_at":"2019-10-25T09:45:40Z","git_url":"git://github.com/guillaumeGilles98/ruptures.git","ssh_url":"git@github.com:guillaumeGilles98/ruptures.git","clone_url":"https://github.com/guillaumeGilles98/ruptures.git","svn_url":"https://github.com/guillaumeGilles98/ruptures","homepage":null,"size":4196,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause","node_id":"MDc6TGljZW5zZTQ="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"deepcharles:master","ref":"master","sha":"abca1f89b8b1a9f668c2ad0eb35fcabfb6656677","user":{"login":"deepcharles","id":14997422,"node_id":"MDQ6VXNlcjE0OTk3NDIy","avatar_url":"https://avatars1.githubusercontent.com/u/14997422?v=4","gravatar_id":"","url":"https://api.github.com/users/deepcharles","html_url":"https://github.com/deepcharles","followers_url":"https://api.github.com/users/deepcharles/followers","following_url":"https://api.github.com/users/deepcharles/following{/other_user}","gists_url":"https://api.github.com/users/deepcharles/gists{/gist_id}","starred_url":"https://api.github.com/users/deepcharles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepcharles/subscriptions","organizations_url":"https://api.github.com/users/deepcharles/orgs","repos_url":"https://api.github.com/users/deepcharles/repos","events_url":"https://api.github.com/users/deepcharles/events{/privacy}","received_events_url":"https://api.github.com/users/deepcharles/received_events","type":"User","site_admin":false},"repo":{"id":118264731,"node_id":"MDEwOlJlcG9zaXRvcnkxMTgyNjQ3MzE=","name":"ruptures","full_name":"deepcharles/ruptures","private":false,"owner":{"login":"deepcharles","id":14997422,"node_id":"MDQ6VXNlcjE0OTk3NDIy","avatar_url":"https://avatars1.githubusercontent.com/u/14997422?v=4","gravatar_id":"","url":"https://api.github.com/users/deepcharles","html_url":"https://github.com/deepcharles","followers_url":"https://api.github.com/users/deepcharles/followers","following_url":"https://api.github.com/users/deepcharles/following{/other_user}","gists_url":"https://api.github.com/users/deepcharles/gists{/gist_id}","starred_url":"https://api.github.com/users/deepcharles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepcharles/subscriptions","organizations_url":"https://api.github.com/users/deepcharles/orgs","repos_url":"https://api.github.com/users/deepcharles/repos","events_url":"https://api.github.com/users/deepcharles/events{/privacy}","received_events_url":"https://api.github.com/users/deepcharles/received_events","type":"User","site_admin":false},"html_url":"https://github.com/deepcharles/ruptures","description":"ruptures: change point detection in Python","fork":false,"url":"https://api.github.com/repos/deepcharles/ruptures","forks_url":"https://api.github.com/repos/deepcharles/ruptures/forks","keys_url":"https://api.github.com/repos/deepcharles/ruptures/keys{/key_id}","collaborators_url":"https://api.github.com/repos/deepcharles/ruptures/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/deepcharles/ruptures/teams","hooks_url":"https://api.github.com/repos/deepcharles/ruptures/hooks","issue_events_url":"https://api.github.com/repos/deepcharles/ruptures/issues/events{/number}","events_url":"https://api.github.com/repos/deepcharles/ruptures/events","assignees_url":"https://api.github.com/repos/deepcharles/ruptures/assignees{/user}","branches_url":"https://api.github.com/repos/deepcharles/ruptures/branches{/branch}","tags_url":"https://api.github.com/repos/deepcharles/ruptures/tags","blobs_url":"https://api.github.com/repos/deepcharles/ruptures/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/deepcharles/ruptures/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/deepcharles/ruptures/git/refs{/sha}","trees_url":"https://api.github.com/repos/deepcharles/ruptures/git/trees{/sha}","statuses_url":"https://api.github.com/repos/deepcharles/ruptures/statuses/{sha}","languages_url":"https://api.github.com/repos/deepcharles/ruptures/languages","stargazers_url":"https://api.github.com/repos/deepcharles/ruptures/stargazers","contributors_url":"https://api.github.com/repos/deepcharles/ruptures/contributors","subscribers_url":"https://api.github.com/repos/deepcharles/ruptures/subscribers","subscription_url":"https://api.github.com/repos/deepcharles/ruptures/subscription","commits_url":"https://api.github.com/repos/deepcharles/ruptures/commits{/sha}","git_commits_url":"https://api.github.com/repos/deepcharles/ruptures/git/commits{/sha}","comments_url":"https://api.github.com/repos/deepcharles/ruptures/comments{/number}","issue_comment_url":"https://api.github.com/repos/deepcharles/ruptures/issues/comments{/number}","contents_url":"https://api.github.com/repos/deepcharles/ruptures/contents/{+path}","compare_url":"https://api.github.com/repos/deepcharles/ruptures/compare/{base}...{head}","merges_url":"https://api.github.com/repos/deepcharles/ruptures/merges","archive_url":"https://api.github.com/repos/deepcharles/ruptures/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/deepcharles/ruptures/downloads","issues_url":"https://api.github.com/repos/deepcharles/ruptures/issues{/number}","pulls_url":"https://api.github.com/repos/deepcharles/ruptures/pulls{/number}","milestones_url":"https://api.github.com/repos/deepcharles/ruptures/milestones{/number}","notifications_url":"https://api.github.com/repos/deepcharles/ruptures/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/deepcharles/ruptures/labels{/name}","releases_url":"https://api.github.com/repos/deepcharles/ruptures/releases{/id}","deployments_url":"https://api.github.com/repos/deepcharles/ruptures/deployments","created_at":"2018-01-20T17:25:20Z","updated_at":"2019-10-18T12:49:34Z","pushed_at":"2019-07-29T12:07:02Z","git_url":"git://github.com/deepcharles/ruptures.git","ssh_url":"git@github.com:deepcharles/ruptures.git","clone_url":"https://github.com/deepcharles/ruptures.git","svn_url":"https://github.com/deepcharles/ruptures","homepage":null,"size":4196,"stargazers_count":291,"watchers_count":291,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":6,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause","node_id":"MDc6TGljZW5zZTQ="},"forks":49,"open_issues":6,"watchers":291,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/deepcharles/ruptures/pulls/14"},"html":{"href":"https://github.com/deepcharles/ruptures/pull/14"},"issue":{"href":"https://api.github.com/repos/deepcharles/ruptures/issues/14"},"comments":{"href":"https://api.github.com/repos/deepcharles/ruptures/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/deepcharles/ruptures/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/deepcharles/ruptures/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/deepcharles/ruptures/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/deepcharles/ruptures/statuses/0bbceb220cafc2b48e880c217d09caf33353b679"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":3,"deletions":1,"changed_files":1}}
other: {"actor":{"display_login":"guillaumeGilles98"}}