{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7914","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7914/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7914/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7914/events","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7914","id":190535710,"number":7914,"title":"[MRG] #7908 Addressed issue in first iteration of RANSAC regression","user":{"login":"mthorrell","id":15166269,"avatar_url":"https://avatars.githubusercontent.com/u/15166269?v=3","gravatar_id":"","url":"https://api.github.com/users/mthorrell","html_url":"https://github.com/mthorrell","followers_url":"https://api.github.com/users/mthorrell/followers","following_url":"https://api.github.com/users/mthorrell/following{/other_user}","gists_url":"https://api.github.com/users/mthorrell/gists{/gist_id}","starred_url":"https://api.github.com/users/mthorrell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mthorrell/subscriptions","organizations_url":"https://api.github.com/users/mthorrell/orgs","repos_url":"https://api.github.com/users/mthorrell/repos","events_url":"https://api.github.com/users/mthorrell/events{/privacy}","received_events_url":"https://api.github.com/users/mthorrell/received_events","type":"User","site_admin":false},"labels":[{"id":12995755,"url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels/Bug","name":"Bug","color":"e10c02","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/21","html_url":"https://github.com/scikit-learn/scikit-learn/milestone/21","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/21/labels","id":1970916,"number":21,"title":"0.19","description":"","creator":{"login":"amueller","id":449558,"avatar_url":"https://avatars.githubusercontent.com/u/449558?v=3","gravatar_id":"","url":"https://api.github.com/users/amueller","html_url":"https://github.com/amueller","followers_url":"https://api.github.com/users/amueller/followers","following_url":"https://api.github.com/users/amueller/following{/other_user}","gists_url":"https://api.github.com/users/amueller/gists{/gist_id}","starred_url":"https://api.github.com/users/amueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amueller/subscriptions","organizations_url":"https://api.github.com/users/amueller/orgs","repos_url":"https://api.github.com/users/amueller/repos","events_url":"https://api.github.com/users/amueller/events{/privacy}","received_events_url":"https://api.github.com/users/amueller/received_events","type":"User","site_admin":false},"open_issues":185,"closed_issues":44,"state":"open","created_at":"2016-08-29T22:34:33Z","updated_at":"2016-12-07T22:33:07Z","due_on":"2017-04-01T00:00:00Z","closed_at":null},"comments":7,"created_at":"2016-11-20T02:54:58Z","updated_at":"2016-12-08T04:26:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7914","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7914","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/7914.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/7914.patch"},"body":"<!--\r\nThanks for contributing a pull request! Please ensure you have taken a look at\r\nthe contribution guidelines: https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md#Contributing-Pull-Requests\r\n-->\r\n#### Reference Issue\r\nFixes #7908 \r\n\r\n\r\n#### What does this implement/fix? Explain your changes.\r\nOn the first iteration of RANSAC regression, if no inliers are found, an error is produced and the code is stopped.  Ideally the procedure would just skip that iteration and continue on to the next iteration where it would use a different random sample which could produce valid inliers.\r\n\r\nGenerally this error is produced when `n_inliers_subset` and `n_inliers_best` are both zero. My fix was to set the initial value for `n_inliers_best` to 1.  Thus if `n_inliers_subset >= 1`, the code follows the normal path, and if `n_inliers_subset == 0`, the code progresses to the next iteration. This fixes the bug as described in this issue.\r\n\r\nHowever, setting `n_inliers_best = 1` creates an issue again in the first iteration of this loop in the case when `n_inliers_subset == 1`. The subsequent comparison is made: `score_subset < score_best`. Since `score_best` is initialized to `np.inf`, the code will incorrectly skip to the next iteration, ignoring the fact that in the first iteration, we did find valid inliers.  The fix for this is to change the initial value of `score_best` to `-np.inf`.  In general, I think this is better practice when initializing these types of variables anyway.\r\n\r\n#### Any other comments?\r\n\r\n\r\n<!--\r\nPlease be aware that we are a loose team of volunteers so patience is\r\nnecessary; assistance handling other issues is very welcome. We value\r\nall user contributions, no matter how minor they are. If we are slow to\r\nreview, either the pull request needs some benchmarking, tinkering,\r\nconvincing, etc. or more likely the reviewers are simply busy. In either\r\ncase, we ask for your understanding during the review process.\r\nFor more information, see our FAQ on this topic:\r\nhttp://scikit-learn.org/dev/faq.html#why-is-my-pull-request-not-getting-any-attention.\r\n\r\nThanks for contributing!\r\n-->\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/265650023","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7914#issuecomment-265650023","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7914","id":265650023,"user":{"login":"jnothman","id":78827,"avatar_url":"https://avatars.githubusercontent.com/u/78827?v=3","gravatar_id":"","url":"https://api.github.com/users/jnothman","html_url":"https://github.com/jnothman","followers_url":"https://api.github.com/users/jnothman/followers","following_url":"https://api.github.com/users/jnothman/following{/other_user}","gists_url":"https://api.github.com/users/jnothman/gists{/gist_id}","starred_url":"https://api.github.com/users/jnothman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnothman/subscriptions","organizations_url":"https://api.github.com/users/jnothman/orgs","repos_url":"https://api.github.com/users/jnothman/repos","events_url":"https://api.github.com/users/jnothman/events{/privacy}","received_events_url":"https://api.github.com/users/jnothman/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T04:26:31Z","updated_at":"2016-12-08T04:26:31Z","body":"(Sorry for my confusions. Was trying to grok the overall algorithm)"}}
{"actor":{"display_login":"jnothman"}}