{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7970","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7970/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7970/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7970/events","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7970","id":193230157,"number":7970,"title":"[WIP] Fix gradient boosting overflow and various other float comparison on ==","user":{"login":"chenhe95","id":11644691,"avatar_url":"https://avatars.githubusercontent.com/u/11644691?v=3","gravatar_id":"","url":"https://api.github.com/users/chenhe95","html_url":"https://github.com/chenhe95","followers_url":"https://api.github.com/users/chenhe95/followers","following_url":"https://api.github.com/users/chenhe95/following{/other_user}","gists_url":"https://api.github.com/users/chenhe95/gists{/gist_id}","starred_url":"https://api.github.com/users/chenhe95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenhe95/subscriptions","organizations_url":"https://api.github.com/users/chenhe95/orgs","repos_url":"https://api.github.com/users/chenhe95/repos","events_url":"https://api.github.com/users/chenhe95/events{/privacy}","received_events_url":"https://api.github.com/users/chenhe95/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-02T22:10:09Z","updated_at":"2016-12-02T23:55:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7970","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7970","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/7970.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/7970.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\nFix https://github.com/scikit-learn/scikit-learn/issues/7717\r\n\r\n#### What does this implement/fix? Explain your changes.\r\nBefore, the code was using == to compare float values and dividing by \"zero (~10e-309)\" which caused an overflow.\r\n```\r\n        if denominator == 0:\r\n            tree.value[leaf, 0, 0] = 0.0\r\n        else:\r\n            tree.value[leaf, 0, 0] = numerator / denominator`\r\n```\r\nNow I made it so that it's\r\n```\r\n        if np.isclose(denominator, 0.0):\r\n            tree.value[leaf, 0, 0] = 0.0\r\n        else:\r\n            tree.value[leaf, 0, 0] = numerator / denominator\r\n```\r\nThere are several other instances of this happening, which may cause an error and I want to also address those later on. \r\n\r\nIn addition, this brings back the numpy.isclose() method which is a standardized way of computing if two float scalars or matrices of arbitrary size are almost close to a threshold. "},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/264594394","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7970#issuecomment-264594394","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7970","id":264594394,"user":{"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},"created_at":"2016-12-02T23:55:49Z","updated_at":"2016-12-02T23:55:49Z","body":"@chenhe95 yeah usually you want \"close to zero\" so you can always do norm < eps"}}
{"actor":{"display_login":"amueller"}}