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

    https://github.com/apache/spark/pull/11124#discussion_r52635130
  
    --- Diff: R/pkg/R/mllib.R ---
    @@ -126,3 +126,27 @@ setMethod("summary", signature(object = 
"PipelineModel"),
                   return(list(coefficients = coefficients))
                 }
               })
    +
    +#' Fit a k-means model
    +#'
    +#' Fit a k-means model, similarly to R's kmeans().
    +#'
    +#' @param x DataFrame for training
    +#' @param centers Number of centers
    +#' @param iter.max Maximum iteration number
    +#' @param algorithm Algorithm choosen to fit the model
    +#' @return A fitted k-means model
    +#' @rdname kmeans
    +#' @export
    +#' @examples
    +#'\dontrun{
    +#' model <- kmeans(x, centers = 2, algorithm="random")
    +#'}
    +setMethod("kmeans", signature(x = "DataFrame"),
    --- End diff --
    
    I don't think we can make the signature the same as stats:kmeans for now, 
since `KMeans` in MLlib doesn't provide the same interface with R's. E.g. 
`KMeans` in MLlib doesn't support warm-start so the `centers` has only to be a 
"numeric", and it doesn't have arguments like `nstart` and `trace`. Refer to 
[the implementation of `glm` in 
SparkR](https://github.com/apache/spark/blob/master/R/pkg/R/mllib.R#L53), which 
also cannot match the signature with R's 100%.


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