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

    https://github.com/apache/spark/pull/14182#discussion_r72715742
  
    --- Diff: R/pkg/R/mllib.R ---
    @@ -292,6 +299,78 @@ setMethod("summary", signature(object = 
"NaiveBayesModel"),
                 return(list(apriori = apriori, tables = tables))
               })
     
    +#' Isotonic Regression Model
    +#'
    +#' Fits an Isotonic Regression model against a Spark DataFrame, similarly 
to R's isoreg().
    +#' 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 isotonic Whether the output sequence should be 
isotonic/increasing (true) or
    +#'                 antitonic/decreasing (false)
    +#' @param featureIndex The index of the feature if \code{featuresCol} is a 
vector column (default: `0`),
    +#'                     no effect otherwise
    +#' @return \code{spark.isoreg} returns a fitted Isotonic Regression model
    +#' @rdname spark.isoreg
    +#' @aliases spark.isoreg,SparkDataFrame,formula-method
    +#' @name spark.isoreg
    +#' @export
    +#' @examples
    +#' \dontrun{
    +#' sparkR.session()
    +#' data <- list(list(7.0, 0.0), list(5.0, 1.0), list(3.0, 2.0),
    +#'         list(5.0, 3.0), list(1.0, 4.0))
    +#' df <- createDataFrame(data, c("label", "feature"))
    +#' model <- spark.isoreg(df, label ~ feature, isotonic = FALSE)
    +#' # return model boundaries and prediction as lists
    +#' result <- summary(model, df)
    +#'
    +#' # save fitted model to input path
    +#' path <- "path/to/model"
    +#' write.ml(model, path)
    +#'
    +#' # can also read back the saved model and print
    +#' savedModel <- read.ml(path)
    +#' summary(savedModel)
    +#' }
    +#' @note spark.isoreg since 2.1.0
    +setMethod("spark.isoreg", signature(data = "SparkDataFrame", formula = 
"formula"),
    +          function(data, formula, isotonic = TRUE, featureIndex = 0) {
    +            formula <- paste0(deparse(formula), collapse = "")
    +            jobj <- 
callJStatic("org.apache.spark.ml.r.IsotonicRegressionWrapper", "fit",
    +            data@sdf, formula, as.logical(isotonic), 
as.integer(featureIndex))
    +            return(new("IsotonicRegressionModel", jobj = jobj))
    +          })
    +
    +#  Predicted values based on an isotonicRegression model
    +
    +#' @param object a fitted isotonicRegressionModel
    +#' @param newData A SparkDataFrame for testing
    +#' @return \code{predict} returns a SparkDataFrame containing predicted 
values
    +#' @rdname spark.isoreg
    +#' @export
    +#' @note predict(isotonicRegressionModel) since 2.1.0
    +setMethod("predict", signature(object = "IsotonicRegressionModel"),
    +          function(object, newData) {
    +            return(dataFrame(callJMethod(object@jobj, "transform", 
newData@sdf)))
    +          })
    +
    +#  Get the summary of a isotonicRegressionModel model
    +
    +#' @param object A fitted isotonicRegressionModel model
    --- End diff --
    
    Documenting `object` in both `predict` and `summary` may create duplicate 
argument fields in the generated doc.


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