Perform the training step of kernel k-means.
kkmeans(K, parameters)
K | Kernel matrix. |
---|---|
parameters | A list containing the number of clusters
|
This function returns a list containing:
the cluster labels for each element (i.e. row/column) of the kernel matrix.
the value of the objective function for the given clustering.
same parameters as in the input.
Gonen, M. and Margolin, A.A., 2014. Localized data fusion for kernel k-means clustering with application to cancer biology. In Advances in Neural Information Processing Systems (pp. 1305-1313).
# Load one dataset with 100 observations, 2 variables, 4 clusters data <- as.matrix(read.csv(system.file("extdata", "dataset1.csv", package = "klic"), row.names = 1)) # Compute consensus clustering with K=4 clusters cm <- coca::consensusCluster(data, 4) # Shift eigenvalues of the matrix by a constant: (min eigenvalue) * (coeff) km <- spectrumShift(cm, coeff = 1.05) # Initalize the parameters of the algorithm parameters <- list() # Set the number of clusters parameters$cluster_count <- 4 # Perform training state <- kkmeans(km, parameters) # Display the clustering print(state$clustering)#> [1] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 #> [38] 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 #> [75] 4 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1