cclsSSLR {SSLR} | R Documentation |
General Interface Pairwise Constrained Clustering By Local Search
Description
Model from conclust
This function takes an unlabeled dataset and two lists of must-link and cannot-link constraints
as input and produce a clustering as output.
Usage
cclsSSLR(
n_clusters = NULL,
mustLink = NULL,
cantLink = NULL,
max_iter = 1,
tabuIter = 100,
tabuLength = 20
)
Arguments
n_clusters |
A number of clusters to be considered. Default is NULL (num classes) |
mustLink |
A list of must-link constraints. NULL Default, constrints same label |
cantLink |
A list of cannot-link constraints. NULL Default, constrints with different label |
max_iter |
maximum iterations in KMeans. Default is 1 |
tabuIter |
Number of iteration in Tabu search |
tabuLength |
The number of elements in the Tabu list |
Note
This models only returns labels, not centers
References
Tran Khanh Hiep, Nguyen Minh Duc, Bui Quoc Trung
Pairwise Constrained Clustering by Local Search
2016
Examples
library(tidyverse)
library(caret)
library(SSLR)
library(tidymodels)
data <- iris
set.seed(1)
#% LABELED
cls <- which(colnames(iris) == "Species")
labeled.index <- createDataPartition(data$Species, p = .2, list = FALSE)
data[-labeled.index,cls] <- NA
m <- cclsSSLR(max_iter = 1) %>% fit(Species ~ ., data)
#Get labels (assing clusters), type = "raw" return factor
labels <- m %>% cluster_labels()
print(labels)
[Package SSLR version 0.9.3.3 Index]