[GitHub] spark pull request #16969: [SPARK-19639][SPARKR][Example]:Add spark.svmLinea...
Github user asfgit closed the pull request at: https://github.com/apache/spark/pull/16969 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16969: [SPARK-19639][SPARKR][Example]:Add spark.svmLinea...
Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/16969#discussion_r101851925 --- Diff: examples/src/main/r/ml/svmLinear.R --- @@ -0,0 +1,41 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +#http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# To run this example use +# ./bin/spark-submit examples/src/main/r/ml/svmLinear.R + +# Load SparkR library into your R session +library(SparkR) + +# Initialize SparkSession +sparkR.session(appName = "SparkR-ML-svmLinear-example") + +# $example on$ +# load training data +t <- as.data.frame(Titanic) +training <- createDataFrame(t) + +# fit Linear SVM model +model <- spark.svmLinear(training, Survived ~ ., regParam = 0.01, maxIter = 10) + +# Model summary +summary(model) + +# Prediction +prediction <- predict(model, training) +showDF(prediction) +# $example off$ --- End diff -- add `sparkR.session.stop()` at the end --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16969: [SPARK-19639][SPARKR][Example]:Add spark.svmLinea...
Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/16969#discussion_r101851832 --- Diff: R/pkg/vignettes/sparkr-vignettes.Rmd --- @@ -564,6 +566,26 @@ model <- spark.logit(df, Species ~ ., regParam = 0.056) summary(model) ``` + Linear Support Vector Machine (SVM) Classifier --- End diff -- this feels minor to me, but there was feedback that these section should be in the same order they are listed (ie sorted alphabetically) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16969: [SPARK-19639][SPARKR][Example]:Add spark.svmLinea...
Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/16969#discussion_r101683604 --- Diff: R/pkg/vignettes/sparkr-vignettes.Rmd --- @@ -564,6 +566,26 @@ model <- spark.logit(df, Species ~ ., regParam = 0.056) summary(model) ``` + Linear Support Vector Machine (SVM) Classifier + +[Linear Support Vector Machine (SVM)](https://en.wikipedia.org/wiki/Support_vector_machine#Linear_SVM) classifier is an SVM classifier with linear kernel. +This is a binary classifier. Multi-class classification can be achieved by one-vs-the-rest strategy. We use a simple example to show how to use `spark.svmLinear` +for binary classification. + +```{r} +# load training data and create a DataFrame +t <- as.data.frame(Titanic) +training <- createDataFrame(t) +# fit a Linear SVM classifier model +model <- spark.svmLinear(training, Survived ~ ., regParam = 0.01) --- End diff -- should it go with `maxIter = 10` here too? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16969: [SPARK-19639][SPARKR][Example]:Add spark.svmLinea...
Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/16969#discussion_r101683480 --- Diff: R/pkg/vignettes/sparkr-vignettes.Rmd --- @@ -564,6 +566,26 @@ model <- spark.logit(df, Species ~ ., regParam = 0.056) summary(model) ``` + Linear Support Vector Machine (SVM) Classifier + +[Linear Support Vector Machine (SVM)](https://en.wikipedia.org/wiki/Support_vector_machine#Linear_SVM) classifier is an SVM classifier with linear kernel. +This is a binary classifier. Multi-class classification can be achieved by one-vs-the-rest strategy. We use a simple example to show how to use `spark.svmLinear` --- End diff -- we actually don't have support for `one-vs-the-rest strategy` in R at the moment (existing JIRA or design still open), so perhaps it's best we don't reference that here --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16969: [SPARK-19639][SPARKR][Example]:Add spark.svmLinea...
Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/16969#discussion_r101683657 --- Diff: examples/src/main/r/ml/svmLinear.R --- @@ -0,0 +1,41 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +#http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# To run this example use +# ./bin/spark-submit examples/src/main/r/ml/svmLinear.R + +# Load SparkR library into your R session +library(SparkR) + +# Initialize SparkSession +sparkR.session(appName = "SparkR-ML-svmLinear-example") + +# $example on$ +# load training data +t <- as.data.frame(Titanic) +training <- createDataFrame(t) + +# fit linearSvc model --- End diff -- `linearSvc` -> `svmLinear`? or `Linear SVM`? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16969: [SPARK-19639][SPARKR][Example]:Add spark.svmLinea...
Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/16969#discussion_r101683410 --- Diff: R/pkg/vignettes/sparkr-vignettes.Rmd --- @@ -564,6 +566,26 @@ model <- spark.logit(df, Species ~ ., regParam = 0.056) summary(model) ``` + Linear Support Vector Machine (SVM) Classifier + +[Linear Support Vector Machine (SVM)](https://en.wikipedia.org/wiki/Support_vector_machine#Linear_SVM) classifier is an SVM classifier with linear kernel. --- End diff -- `linear kernels`? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16969: [SPARK-19639][SPARKR][Example]:Add spark.svmLinea...
Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/16969#discussion_r101683369 --- Diff: R/pkg/vignettes/sparkr-vignettes.Rmd --- @@ -471,6 +471,8 @@ SparkR supports the following machine learning models and algorithms. * Logistic Regression +* Linear Support Vector Machine (SVM) Classifier --- End diff -- shouldn't `Linear` go before `Logistic`? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16969: [SPARK-19639][SPARKR][Example]:Add spark.svmLinea...
GitHub user wangmiao1981 opened a pull request: https://github.com/apache/spark/pull/16969 [SPARK-19639][SPARKR][Example]:Add spark.svmLinear example and update vignettes ## What changes were proposed in this pull request? We recently add the spark.svmLinear API for SparkR. We need to add an example and update the vignettes. ## How was this patch tested? Manually run example. You can merge this pull request into a Git repository by running: $ git pull https://github.com/wangmiao1981/spark example Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/16969.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #16969 commit 6e54a4d0c2f05cb017b3ce4ce105a723d03a9306 Author: wm...@hotmail.comDate: 2017-02-17T00:07:39Z add example and vignnettes --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org