{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/15788","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/15788/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/15788/comments","events_url":"https://api.github.com/repos/apache/spark/issues/15788/events","html_url":"https://github.com/apache/spark/pull/15788","id":187544372,"number":15788,"title":"[SPARK-18291][SparkR][ML] SparkR glm predict should output original label when family = binomial.","user":{"login":"yanboliang","id":1962026,"avatar_url":"https://avatars.githubusercontent.com/u/1962026?v=3","gravatar_id":"","url":"https://api.github.com/users/yanboliang","html_url":"https://github.com/yanboliang","followers_url":"https://api.github.com/users/yanboliang/followers","following_url":"https://api.github.com/users/yanboliang/following{/other_user}","gists_url":"https://api.github.com/users/yanboliang/gists{/gist_id}","starred_url":"https://api.github.com/users/yanboliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanboliang/subscriptions","organizations_url":"https://api.github.com/users/yanboliang/orgs","repos_url":"https://api.github.com/users/yanboliang/repos","events_url":"https://api.github.com/users/yanboliang/events{/privacy}","received_events_url":"https://api.github.com/users/yanboliang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-06T05:59:34Z","updated_at":"2016-11-06T17:03:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/15788","html_url":"https://github.com/apache/spark/pull/15788","diff_url":"https://github.com/apache/spark/pull/15788.diff","patch_url":"https://github.com/apache/spark/pull/15788.patch"},"body":"## What changes were proposed in this pull request?\r\nSparkR ```spark.glm``` predict should output original label when family = \"binomial\".\r\n\r\n## How was this patch tested?\r\nAdd unit test.\r\nYou can also run the following code to test:\r\n```R\r\ntraining <- suppressWarnings(createDataFrame(iris))\r\ntraining <- training[training$Species %in% c(\"versicolor\", \"virginica\"), ]\r\nmodel <- spark.glm(training, Species ~ Sepal_Length + Sepal_Width,family = binomial(link = \"logit\"))\r\nshowDF(predict(model, training))\r\n```\r\nBefore this change:\r\n```\r\n+------------+-----------+------------+-----------+----------+-----+-------------------+\r\n|Sepal_Length|Sepal_Width|Petal_Length|Petal_Width|   Species|label|         prediction|\r\n+------------+-----------+------------+-----------+----------+-----+-------------------+\r\n|         7.0|        3.2|         4.7|        1.4|versicolor|  0.0| 0.8271421517601544|\r\n|         6.4|        3.2|         4.5|        1.5|versicolor|  0.0| 0.6044595910413112|\r\n|         6.9|        3.1|         4.9|        1.5|versicolor|  0.0| 0.7916340858281998|\r\n|         5.5|        2.3|         4.0|        1.3|versicolor|  0.0|0.16080518180591158|\r\n|         6.5|        2.8|         4.6|        1.5|versicolor|  0.0| 0.6112229217050189|\r\n|         5.7|        2.8|         4.5|        1.3|versicolor|  0.0| 0.2555087295500885|\r\n|         6.3|        3.3|         4.7|        1.6|versicolor|  0.0| 0.5681507664364834|\r\n|         4.9|        2.4|         3.3|        1.0|versicolor|  0.0|0.05990570219972002|\r\n|         6.6|        2.9|         4.6|        1.3|versicolor|  0.0| 0.6644434078306246|\r\n|         5.2|        2.7|         3.9|        1.4|versicolor|  0.0|0.11293577405862379|\r\n|         5.0|        2.0|         3.5|        1.0|versicolor|  0.0|0.06152372321585971|\r\n|         5.9|        3.0|         4.2|        1.5|versicolor|  0.0|0.35250697207602555|\r\n|         6.0|        2.2|         4.0|        1.0|versicolor|  0.0|0.32267018290814303|\r\n|         6.1|        2.9|         4.7|        1.4|versicolor|  0.0|  0.433391153814592|\r\n|         5.6|        2.9|         3.6|        1.3|versicolor|  0.0| 0.2280744262436993|\r\n|         6.7|        3.1|         4.4|        1.4|versicolor|  0.0| 0.7219848389339459|\r\n|         5.6|        3.0|         4.5|        1.5|versicolor|  0.0|0.23527698971404695|\r\n|         5.8|        2.7|         4.1|        1.0|versicolor|  0.0|  0.285024533520016|\r\n|         6.2|        2.2|         4.5|        1.5|versicolor|  0.0| 0.4107047877447493|\r\n|         5.6|        2.5|         3.9|        1.1|versicolor|  0.0|0.20083561961645083|\r\n+------------+-----------+------------+-----------+----------+-----+-------------------+\r\n```\r\nAfter this change: \r\n```\r\n+------------+-----------+------------+-----------+----------+-----+----------+\r\n|Sepal_Length|Sepal_Width|Petal_Length|Petal_Width|   Species|label|prediction|\r\n+------------+-----------+------------+-----------+----------+-----+----------+\r\n|         7.0|        3.2|         4.7|        1.4|versicolor|  0.0| virginica|\r\n|         6.4|        3.2|         4.5|        1.5|versicolor|  0.0| virginica|\r\n|         6.9|        3.1|         4.9|        1.5|versicolor|  0.0| virginica|\r\n|         5.5|        2.3|         4.0|        1.3|versicolor|  0.0|versicolor|\r\n|         6.5|        2.8|         4.6|        1.5|versicolor|  0.0| virginica|\r\n|         5.7|        2.8|         4.5|        1.3|versicolor|  0.0|versicolor|\r\n|         6.3|        3.3|         4.7|        1.6|versicolor|  0.0| virginica|\r\n|         4.9|        2.4|         3.3|        1.0|versicolor|  0.0|versicolor|\r\n|         6.6|        2.9|         4.6|        1.3|versicolor|  0.0| virginica|\r\n|         5.2|        2.7|         3.9|        1.4|versicolor|  0.0|versicolor|\r\n|         5.0|        2.0|         3.5|        1.0|versicolor|  0.0|versicolor|\r\n|         5.9|        3.0|         4.2|        1.5|versicolor|  0.0|versicolor|\r\n|         6.0|        2.2|         4.0|        1.0|versicolor|  0.0|versicolor|\r\n|         6.1|        2.9|         4.7|        1.4|versicolor|  0.0|versicolor|\r\n|         5.6|        2.9|         3.6|        1.3|versicolor|  0.0|versicolor|\r\n|         6.7|        3.1|         4.4|        1.4|versicolor|  0.0| virginica|\r\n|         5.6|        3.0|         4.5|        1.5|versicolor|  0.0|versicolor|\r\n|         5.8|        2.7|         4.1|        1.0|versicolor|  0.0|versicolor|\r\n|         6.2|        2.2|         4.5|        1.5|versicolor|  0.0|versicolor|\r\n|         5.6|        2.5|         3.9|        1.1|versicolor|  0.0|versicolor|\r\n+------------+-----------+------------+-----------+----------+-----+----------+\r\n```"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/258694326","html_url":"https://github.com/apache/spark/pull/15788#issuecomment-258694326","issue_url":"https://api.github.com/repos/apache/spark/issues/15788","id":258694326,"user":{"login":"AmplabJenkins","id":4031291,"avatar_url":"https://avatars.githubusercontent.com/u/4031291?v=3","gravatar_id":"","url":"https://api.github.com/users/AmplabJenkins","html_url":"https://github.com/AmplabJenkins","followers_url":"https://api.github.com/users/AmplabJenkins/followers","following_url":"https://api.github.com/users/AmplabJenkins/following{/other_user}","gists_url":"https://api.github.com/users/AmplabJenkins/gists{/gist_id}","starred_url":"https://api.github.com/users/AmplabJenkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmplabJenkins/subscriptions","organizations_url":"https://api.github.com/users/AmplabJenkins/orgs","repos_url":"https://api.github.com/users/AmplabJenkins/repos","events_url":"https://api.github.com/users/AmplabJenkins/events{/privacy}","received_events_url":"https://api.github.com/users/AmplabJenkins/received_events","type":"User","site_admin":false},"created_at":"2016-11-06T17:03:07Z","updated_at":"2016-11-06T17:03:07Z","body":"Test PASSed.\nRefer to this link for build results (access rights to CI server needed): \nhttps://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/68243/\nTest PASSed."}}
{"actor":{"display_login":"AmplabJenkins"}}