{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/92879246","pull_request_review_id":13404113,"id":92879246,"diff_hunk":"@@ -496,9 +508,114 @@ count(carsDF_test)\n head(carsDF_test)\n ```\n \n-\n ### Models and Algorithms\n \n+#### Logistic Regression Model\n+\n+[Logistic regression](https://en.wikipedia.org/wiki/Logistic_regression) is a widely-used model when the response is categorical. It can be seen as a special case of the [Generalized Linear Predictive Model](https://en.wikipedia.org/wiki/Generalized_linear_model).\n+We provide `spark.logit` on top of `spark.glm` to support logistic regression with advanced hyper-parameters.\n+It supports both binary and multiclass classification with elastic-net regularization and feature standardization, similar to `glmnet`.\n+\n+We use a simple example to demonstrate `spark.logit` usage. In general, there are three steps of using `spark.logit`:\n+1). Create a dataframe from a proper data source; 2). Fit a logistic regression model using `spark.logit` with a proper parameter setting;\n+and 3). Obtain the coefficient matrix of the fitted model using `summary` and use the model for prediction with `predict`.\n+\n+Binomial logistic regression\n+```{r, warning=FALSE}\n+df <- createDataFrame(iris)\n+# Create a DataFrame containing two classes\n+training <- df[df$Species %in% c(\"versicolor\", \"virginica\"), ]\n+model <- spark.logit(training, Species ~ ., regParam = 0.00042)\n+summary(model)\n+```\n+\n+Predict values on training data\n+```{r}\n+fitted <- predict(model, training)\n+```\n+\n+Multinomial logistic regression against three classes\n+```{r, warning=FALSE}\n+df <- createDataFrame(iris)\n+# Note in this case, Spark infers it is multinomial logistic regression, so family = \"multinomial\" is optional.\n+model <- spark.logit(df, Species ~ ., regParam = 0.056)\n+summary(model)\n+```\n+\n+#### Multilayer Perceptron","path":"R/pkg/vignettes/sparkr-vignettes.Rmd","position":93,"original_position":93,"commit_id":"2f17e1e00d19731c241e2e77a522d9dd849073e7","original_commit_id":"2f17e1e00d19731c241e2e77a522d9dd849073e7","user":{"login":"mengxr","id":829644,"avatar_url":"https://avatars.githubusercontent.com/u/829644?v=3","gravatar_id":"","url":"https://api.github.com/users/mengxr","html_url":"https://github.com/mengxr","followers_url":"https://api.github.com/users/mengxr/followers","following_url":"https://api.github.com/users/mengxr/following{/other_user}","gists_url":"https://api.github.com/users/mengxr/gists{/gist_id}","starred_url":"https://api.github.com/users/mengxr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mengxr/subscriptions","organizations_url":"https://api.github.com/users/mengxr/orgs","repos_url":"https://api.github.com/users/mengxr/repos","events_url":"https://api.github.com/users/mengxr/events{/privacy}","received_events_url":"https://api.github.com/users/mengxr/received_events","type":"User","site_admin":false},"body":"+1 on removing `model` at the end","created_at":"2016-12-16T20:18:30Z","updated_at":"2016-12-16T20:18:30Z","html_url":"https://github.com/apache/spark/pull/16301#discussion_r92879246","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/16301","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/92879246"},"html":{"href":"https://github.com/apache/spark/pull/16301#discussion_r92879246"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/16301"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/16301","id":98260837,"html_url":"https://github.com/apache/spark/pull/16301","diff_url":"https://github.com/apache/spark/pull/16301.diff","patch_url":"https://github.com/apache/spark/pull/16301.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/16301","number":16301,"state":"open","locked":false,"title":"[SPARK-18849][ML][SPARKR][DOC] vignettes final check reorg","user":{"login":"felixcheung","id":8969467,"avatar_url":"https://avatars.githubusercontent.com/u/8969467?v=3","gravatar_id":"","url":"https://api.github.com/users/felixcheung","html_url":"https://github.com/felixcheung","followers_url":"https://api.github.com/users/felixcheung/followers","following_url":"https://api.github.com/users/felixcheung/following{/other_user}","gists_url":"https://api.github.com/users/felixcheung/gists{/gist_id}","starred_url":"https://api.github.com/users/felixcheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixcheung/subscriptions","organizations_url":"https://api.github.com/users/felixcheung/orgs","repos_url":"https://api.github.com/users/felixcheung/repos","events_url":"https://api.github.com/users/felixcheung/events{/privacy}","received_events_url":"https://api.github.com/users/felixcheung/received_events","type":"User","site_admin":false},"body":"## What changes were proposed in this pull request?\r\n\r\nReorganizing content (copy/paste)\r\n\r\n## How was this patch tested?\r\n\r\nhttps://felixcheung.github.io/sparkr-vignettes.html\r\n\r\nPrevious:\r\nhttps://felixcheung.github.io/sparkr-vignettes_old.html","created_at":"2016-12-16T00:54:42Z","updated_at":"2016-12-16T20:18:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fec03d9403379f0a74daae8736c5d8178df2064a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/16301/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/16301/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/16301/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/2f17e1e00d19731c241e2e77a522d9dd849073e7","head":{"label":"felixcheung:rvignettespass2","ref":"rvignettespass2","sha":"2f17e1e00d19731c241e2e77a522d9dd849073e7","user":{"login":"felixcheung","id":8969467,"avatar_url":"https://avatars.githubusercontent.com/u/8969467?v=3","gravatar_id":"","url":"https://api.github.com/users/felixcheung","html_url":"https://github.com/felixcheung","followers_url":"https://api.github.com/users/felixcheung/followers","following_url":"https://api.github.com/users/felixcheung/following{/other_user}","gists_url":"https://api.github.com/users/felixcheung/gists{/gist_id}","starred_url":"https://api.github.com/users/felixcheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixcheung/subscriptions","organizations_url":"https://api.github.com/users/felixcheung/orgs","repos_url":"https://api.github.com/users/felixcheung/repos","events_url":"https://api.github.com/users/felixcheung/events{/privacy}","received_events_url":"https://api.github.com/users/felixcheung/received_events","type":"User","site_admin":false},"repo":{"id":28383886,"name":"spark","full_name":"felixcheung/spark","owner":{"login":"felixcheung","id":8969467,"avatar_url":"https://avatars.githubusercontent.com/u/8969467?v=3","gravatar_id":"","url":"https://api.github.com/users/felixcheung","html_url":"https://github.com/felixcheung","followers_url":"https://api.github.com/users/felixcheung/followers","following_url":"https://api.github.com/users/felixcheung/following{/other_user}","gists_url":"https://api.github.com/users/felixcheung/gists{/gist_id}","starred_url":"https://api.github.com/users/felixcheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixcheung/subscriptions","organizations_url":"https://api.github.com/users/felixcheung/orgs","repos_url":"https://api.github.com/users/felixcheung/repos","events_url":"https://api.github.com/users/felixcheung/events{/privacy}","received_events_url":"https://api.github.com/users/felixcheung/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/felixcheung/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/felixcheung/spark","forks_url":"https://api.github.com/repos/felixcheung/spark/forks","keys_url":"https://api.github.com/repos/felixcheung/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/felixcheung/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/felixcheung/spark/teams","hooks_url":"https://api.github.com/repos/felixcheung/spark/hooks","issue_events_url":"https://api.github.com/repos/felixcheung/spark/issues/events{/number}","events_url":"https://api.github.com/repos/felixcheung/spark/events","assignees_url":"https://api.github.com/repos/felixcheung/spark/assignees{/user}","branches_url":"https://api.github.com/repos/felixcheung/spark/branches{/branch}","tags_url":"https://api.github.com/repos/felixcheung/spark/tags","blobs_url":"https://api.github.com/repos/felixcheung/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/felixcheung/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/felixcheung/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/felixcheung/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/felixcheung/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/felixcheung/spark/languages","stargazers_url":"https://api.github.com/repos/felixcheung/spark/stargazers","contributors_url":"https://api.github.com/repos/felixcheung/spark/contributors","subscribers_url":"https://api.github.com/repos/felixcheung/spark/subscribers","subscription_url":"https://api.github.com/repos/felixcheung/spark/subscription","commits_url":"https://api.github.com/repos/felixcheung/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/felixcheung/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/felixcheung/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/felixcheung/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/felixcheung/spark/contents/{+path}","compare_url":"https://api.github.com/repos/felixcheung/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/felixcheung/spark/merges","archive_url":"https://api.github.com/repos/felixcheung/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/felixcheung/spark/downloads","issues_url":"https://api.github.com/repos/felixcheung/spark/issues{/number}","pulls_url":"https://api.github.com/repos/felixcheung/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/felixcheung/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/felixcheung/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/felixcheung/spark/labels{/name}","releases_url":"https://api.github.com/repos/felixcheung/spark/releases{/id}","deployments_url":"https://api.github.com/repos/felixcheung/spark/deployments","created_at":"2014-12-23T07:16:52Z","updated_at":"2015-03-08T00:47:37Z","pushed_at":"2016-12-16T05:09:31Z","git_url":"git://github.com/felixcheung/spark.git","ssh_url":"git@github.com:felixcheung/spark.git","clone_url":"https://github.com/felixcheung/spark.git","svn_url":"https://github.com/felixcheung/spark","homepage":null,"size":253226,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"branch-1.3"}},"base":{"label":"apache:master","ref":"master","sha":"9634018c4d6d5a4f2c909f7227d91e637107b7f4","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","deployments_url":"https://api.github.com/repos/apache/spark/deployments","created_at":"2014-02-25T08:00:08Z","updated_at":"2016-12-16T14:44:24Z","pushed_at":"2016-12-16T20:04:01Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":258350,"stargazers_count":11097,"watchers_count":11097,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10409,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":434,"forks":10409,"open_issues":434,"watchers":11097,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/16301"},"html":{"href":"https://github.com/apache/spark/pull/16301"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/16301"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/16301/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/16301/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/16301/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/2f17e1e00d19731c241e2e77a522d9dd849073e7"}}}}
{"actor":{"display_login":"mengxr"}}