{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/3928","labels_url":"https://api.github.com/repos/apache/spark/issues/3928/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/3928/comments","events_url":"https://api.github.com/repos/apache/spark/issues/3928/events","html_url":"https://github.com/apache/spark/pull/3928","id":53606983,"number":3928,"title":"[SPARK-5127][MLlib] Fixed overflow when there are outliers in data in Logistic Regression","user":{"login":"dbtsai","id":1134574,"avatar_url":"https://avatars.githubusercontent.com/u/1134574?v=3","gravatar_id":"","url":"https://api.github.com/users/dbtsai","html_url":"https://github.com/dbtsai","followers_url":"https://api.github.com/users/dbtsai/followers","following_url":"https://api.github.com/users/dbtsai/following{/other_user}","gists_url":"https://api.github.com/users/dbtsai/gists{/gist_id}","starred_url":"https://api.github.com/users/dbtsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbtsai/subscriptions","organizations_url":"https://api.github.com/users/dbtsai/orgs","repos_url":"https://api.github.com/users/dbtsai/repos","events_url":"https://api.github.com/users/dbtsai/events{/privacy}","received_events_url":"https://api.github.com/users/dbtsai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-07T07:57:56Z","updated_at":"2015-01-07T08:02:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/3928","html_url":"https://github.com/apache/spark/pull/3928","diff_url":"https://github.com/apache/spark/pull/3928.diff","patch_url":"https://github.com/apache/spark/pull/3928.patch"},"body":"`gradientMultiplier = (1.0 / (1.0 + math.exp(margin))) - label`\r\n\r\nHowever, the first part of gradientMultiplier will be suffered from overflow \r\nif there are samples far away from hyperplane, and this happens \r\nwhen there are outliers in data. \r\n\r\nAs a result, we use the equivalent formula but more numerically stable.\r\n```scala\r\nval gradientMultiplier =\r\n  if (margin > 0.0) {\r\n    val temp = math.exp(-margin) \r\n    temp / (1.0 + temp) - label \r\n  } else { \r\n    1.0 / (1.0 + math.exp(margin)) - label \r\n  }\r\n```"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/68989827","html_url":"https://github.com/apache/spark/pull/3928#issuecomment-68989827","issue_url":"https://api.github.com/repos/apache/spark/issues/3928","id":68989827,"user":{"login":"SparkQA","id":8108735,"avatar_url":"https://avatars.githubusercontent.com/u/8108735?v=3","gravatar_id":"","url":"https://api.github.com/users/SparkQA","html_url":"https://github.com/SparkQA","followers_url":"https://api.github.com/users/SparkQA/followers","following_url":"https://api.github.com/users/SparkQA/following{/other_user}","gists_url":"https://api.github.com/users/SparkQA/gists{/gist_id}","starred_url":"https://api.github.com/users/SparkQA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SparkQA/subscriptions","organizations_url":"https://api.github.com/users/SparkQA/orgs","repos_url":"https://api.github.com/users/SparkQA/repos","events_url":"https://api.github.com/users/SparkQA/events{/privacy}","received_events_url":"https://api.github.com/users/SparkQA/received_events","type":"User","site_admin":false},"created_at":"2015-01-07T08:02:32Z","updated_at":"2015-01-07T08:02:32Z","body":"  [Test build #25153 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/25153/consoleFull) for   PR 3928 at commit [`ee7a9d8`](https://github.com/apache/spark/commit/ee7a9d85e560ea0dd21dce16846b718434838d29).\n * This patch merges cleanly."}}