Github user keypointt commented on a diff in the pull request: https://github.com/apache/spark/pull/14447#discussion_r74710214 --- Diff: R/pkg/R/mllib.R --- @@ -414,6 +421,94 @@ setMethod("predict", signature(object = "KMeansModel"), return(dataFrame(callJMethod(object@jobj, "transform", newData@sdf))) }) +#' Multilayer Perceptron Classification Model +#' +#' \code{spark.mlp} fits a multi-layer perceptron neural network model against a SparkDataFrame. +#' Users can call \code{summary} to print a summary of the fitted model, \code{predict} to make +#' predictions on new data, and \code{write.ml}/\code{read.ml} to save/load fitted models. +#' Only categorical data is supported. +#' For more details, see +#' \href{http://spark.apache.org/docs/latest/ml-classification-regression.html +#' #multilayer-perceptron-classifier}{Multilayerperceptron classifier}. +#' +#' @param data A \code{SparkDataFrame} of observations and labels for model fitting +#' @param blockSize BlockSize parameter +#' @param layers Integer vector containing the number of nodes for each layer +#' @param solver Solver parameter, supported options: "gd" (minibatch gradient descent) or "l-bfgs" +#' @param maxIter Maximum iteration number +#' @param tol Convergence tolerance of iterations +#' @param stepSize StepSize parameter +#' @param seed Seed parameter for weights initialization +#' @return \code{spark.mlp} returns a fitted Multilayer Perceptron Classification Model +#' @rdname spark.mlp +#' @aliases spark.mlp,SparkDataFrame-method +#' @name spark.mlp +#' @seealso \link{read.ml} +#' @export +#' @examples +#' \dontrun{ +#' df <- read.df("data/mllib/sample_multiclass_classification_data.txt", source = "libsvm") +#' +#' # fit a Multilayer Perceptron Classification Model +#' model <- spark.mlp(df, blockSize = 128, layers = c(4, 5, 4, 3), solver = "l-bfgs", +#' maxIter = 100, tol = 0.5, stepSize = 1, seed = 1) +#' +#' # get the summary of the model +#' summary(model) +#' +#' # make predictions +#' predictions <- predict(model, df) +#' +#' # save and load the model +#' path <- "path/to/model" +#' write.ml(model, path) +#' savedModel <- read.ml(path) +#' summary(savedModel) +#' } +#' @note spark.mlp since 2.1.0 +setMethod("spark.mlp", signature(data = "SparkDataFrame"), + function(data, blockSize = 128, layers = c(3, 5, 2), solver = "l-bfgs", maxIter = 100, + tol = 0.5, stepSize = 1, seed = 1, ...) { --- End diff -- oh this `...` is just following what it is from other wrappers, or I should remove `...` for this one as well as `spark.naiveBayes` and `spark.survreg`? https://github.com/apache/spark/blob/master/R/pkg/R/mllib.R#L455 https://github.com/apache/spark/blob/master/R/pkg/R/mllib.R#L601
--- 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