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

    https://github.com/apache/spark/pull/12680#discussion_r61066043
  
    --- Diff: R/pkg/R/mllib.R ---
    @@ -243,6 +243,54 @@ setMethod("kmeans", signature(x = "SparkDataFrame"),
                 return(new("KMeansModel", jobj = jobj))
              })
     
    +#' Save the KMeans model to the input path.
    +#'
    +#' @param object A fitted KMeans model
    +#' @param path The directory where the model is saved
    +#' @param overwrite Overwrites or not if the output path already exists. 
Default is FALSE
    +#'                  which means throw exception if the output path exists.
    +#'
    +#' @rdname ml.save
    +#' @name ml.save
    +#' @export
    +#' @examples
    +#' \dontrun{
    +#' df <- createDataFrame(sqlContext, infert)
    +#' model <- KMeans(df)
    +#' path <- "path/to/model"
    +#' ml.save(model, path)
    +#' }
    +setMethod("ml.save", signature(object = "KMeansModel", path = "character"),
    +function(object, path, overwrite = FALSE) {
    +    writer <- callJMethod(object@jobj, "write")
    +    if (overwrite) {
    +        writer <- callJMethod(writer, "overwrite")
    +    }
    +    invisible(callJMethod(writer, "save", path))
    +})
    +
    +#' Load a fitted MLlib model from the input path.
    +#'
    +#' @param path Path of the model to read.
    +#' @return a fitted MLlib model
    +#' @rdname ml.load
    +#' @name ml.load
    +#' @export
    +#' @examples
    +#' \dontrun{
    +#' path <- "path/to/model"
    +#' model <- ml.load(path)
    +#' }
    +ml.load <- function(path) {
    --- End diff --
    
    @GayathriMurali  It's not necessary to implement separate ```ml.load``` for 
each R model, we can load all models by the same ```ml.load``` method.


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

Reply via email to