Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/16800#discussion_r101121442
--- Diff: R/pkg/R/mllib_classification.R ---
@@ -39,6 +46,131 @@ setClass("MultilayerPerceptronClassificationModel",
representation(jobj = "jobj"
#' @note NaiveBayesModel since 2.0.0
setClass("NaiveBayesModel", representation(jobj = "jobj"))
+#' linear SVM Model
+#'
+#' Fits an linear SVM model against a SparkDataFrame. It is a binary
classifier, similar to svm in glmnet package
+#' Users can print, make predictions on the produced model and save the
model to the input path.
+#'
+#' @param data SparkDataFrame for training.
+#' @param formula A symbolic description of the model to be fitted.
Currently only a few formula
+#' operators are supported, including '~', '.', ':', '+',
and '-'.
+#' @param regParam The regularization parameter.
+#' @param maxIter Maximum iteration number.
+#' @param tol Convergence tolerance of iterations.
+#' @param standardization Whether to standardize the training features
before fitting the model. The coefficients
+#' of models will be always returned on the
original scale, so it will be transparent for
+#' users. Note that with/without standardization,
the models should be always converged
+#' to the same solution when no regularization is
applied.
+#' @param threshold The threshold in binary classification, in range [0,
1].
+#' @param weightCol The weight column name.
+#' @param aggregationDepth The depth for treeAggregate (greater than or
equal to 2). If the dimensions of features
+#' or the number of partitions are large, this
param could be adjusted to a larger size.
+#' This is an expert parameter. Default value
should be good for most cases.
+#' @param ... additional arguments passed to the method.
+#' @return \code{spark.svmLinear} returns a fitted linear SVM model.
+#' @rdname spark.svmLinear
+#' @aliases spark.svmLinear,SparkDataFrame,formula-method
+#' @name spark.svmLinear
+#' @export
+#' @examples
+#' \dontrun{
+#' sparkR.session()
+#' df <- createDataFrame(iris)
+#' training <- df[df$Species %in% c("versicolor", "virginica"), ]
+#' model <- spark.svmLinear(training, Species ~ ., regParam = 0.5)
+#' summary <- summary(model)
+#'
+#' # fitted values on training data
+#' fitted <- predict(model, training)
+#'
+#' # save fitted model to input path
+#' path <- "path/to/model"
+#' write.ml(model, path)
+#'
+#' # can also read back the saved model and predict
+#' # Note that summary deos not work on loaded model
+#' savedModel <- read.ml(path)
+#' summary(savedModel)
+#' }
+#' @note spark.svmLinear since 2.2.0
+setMethod("spark.svmLinear", signature(data = "SparkDataFrame", formula =
"formula"),
+ function(data, formula, regParam = 0.0, maxIter = 100, tol =
1E-6, standardization = TRUE,
+ threshold = 0.5, weightCol = NULL, aggregationDepth =
2) {
--- End diff --
shouldn't we change threashold = 0.0 to match scala as discussed here
https://github.com/apache/spark/pull/16800#discussion_r100710324
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]