Description Usage Arguments Value Examples
View source: R/predict.monoclust.R
Predict the cluster memberships of a new data set from a MonoClust
object.
1 2 |
object |
MonoClust result object. |
newdata |
Data frame containing the values to be predicted. If missing, the memberships of the MonoClust object are returned. |
type |
Type of returned cluster representatives. Either |
... |
Further arguments passed to or from other methods. |
A tibble of cluster index in cname
and either centroid values or
medoid observations index based on the value of type
argument.
1 2 3 4 5 6 7 8 9 10 11 | library(cluster)
data(ruspini)
set.seed(1234)
test_index <- sample(1:nrow(ruspini), nrow(ruspini)/5)
train_index <- setdiff(1:nrow(ruspini), test_index)
ruspini_train <- ruspini[train_index, ]
ruspini_test <- ruspini[test_index, ]
ruspini_train_4sol <- MonoClust(ruspini_train, nclusters = 4)
predict(ruspini_train_4sol, newdata = ruspini_test)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.