Github user wangmiao1981 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16800#discussion_r100710403
  
    --- Diff: R/pkg/R/mllib_classification.R ---
    @@ -39,6 +46,116 @@ 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. Default is TRUE, same as glmnet.
    +#' @param threshold The threshold in binary classification, in range [0, 
1].
    +#' @param weightCol The weight column name.
    +#' @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) {
    +            formula <- paste(deparse(formula), collapse = "")
    +
    +            if (is.null(weightCol)) {
    +              weightCol <- ""
    --- End diff --
    
    I think null is better. There are several places like this. Let me double 
check. Then, I will fix them all in another PR. Thanks!


---
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

Reply via email to