| PamParam-class {bluster} | R Documentation |
Partition observations into k-medoids as a more robust version of k-means.
PamParam( centers, metric = NULL, medoids = NULL, nstart = NULL, stand = NULL, do.swap = NULL, variant = NULL ) ## S4 method for signature 'ANY,PamParam' clusterRows(x, BLUSPARAM, full = FALSE)
centers |
An integer scalar specifying the number of centers. Alternatively, a function that takes the number of observations and returns the number of centers. |
metric, medoids, nstart, stand, do.swap, variant |
Further arguments to pass to |
x |
A numeric matrix-like object where rows represent observations and columns represent variables. |
BLUSPARAM |
A PamParam object. |
full |
Logical scalar indicating whether the full PAM statistics should be returned. |
This class usually requires the user to specify the number of clusters beforehand. However, we can also allow the number of clusters to vary as a function of the number of observations. The latter is occasionally useful, e.g., to allow the clustering to automatically become more granular for large datasets.
To modify an existing PamParam object x,
users can simply call x[[i]] or x[[i]] <- value where i is any argument used in the constructor.
The PamParam constructor will return a PamParam object with the specified parameters.
The clusterRows method will return a factor of length equal to nrow(x) containing the cluster assignments.
If full=TRUE, a list is returned with clusters (the factor, as above) and objects
(a list containing pam, the direct output of pam).
Aaron Lun
pam, which actually does all the heavy lifting.
KmeansParam, for the more commonly used k-means algorithm.
ClaraParam, for a scalable extension to the PAM approach.
clusterRows(iris[,1:4], PamParam(centers=4)) clusterRows(iris[,1:4], PamParam(centers=4, variant="faster", do.swap=FALSE)) clusterRows(iris[,1:4], PamParam(centers=sqrt))