genetic_kmeans {UAHDataScienceUC} | R Documentation |
Genetic K-Means Clustering
Description
Performs Genetic K-Means clustering on a data matrix.
Usage
genetic_kmeans(
data,
k,
population_size = 10,
mut_probability = 0.5,
max_generations = 10,
learn = FALSE,
waiting = TRUE,
...
)
Arguments
data |
a set of observations, presented as a matrix-like object where every row is a new observation. |
k |
the number of clusters. |
population_size |
the number of individuals in the population. |
mut_probability |
the probability of a mutation occurring. |
max_generations |
the maximum number of iterations allowed. |
learn |
a Boolean determining whether intermediate logs explaining how the algorithm works should be printed or not. |
waiting |
a Boolean determining whether the intermediate logs should be printed in chunks waiting for user input before printing the next or not. |
... |
additional arguments passed to |
Value
A kmeans object as returned by the original kmeans function.
Author(s)
Eduardo Ruiz Sabajanes, eduardo.ruizs@edu.uah.es
Examples
### Example 1: Simple usage with circles dataset
result1 <- genetic_kmeans(db1[1:20,], 2, learn = TRUE, waiting = FALSE)
### Example 2: Moons dataset with different population size
result2 <- genetic_kmeans(db2[1:20,], 2, population_size = 20,
learn = TRUE, waiting = FALSE)
### Example 3: Varying density clusters with different mutation probability
result3 <- genetic_kmeans(db3[1:20,], 3, mut_probability = 0.7,
learn = TRUE, waiting = FALSE)
### Example 4: Well-separated clusters with larger population
result5 <- genetic_kmeans(db5[1:20,], 3, population_size = 30,
mut_probability = 0.6, learn = TRUE, waiting = FALSE)
### Example 5: Using different parameters combinations
result6 <- genetic_kmeans(db1[1:20,], 2,
population_size = 15,
mut_probability = 0.8,
max_generations = 15,
learn = TRUE,
waiting = FALSE)
[Package UAHDataScienceUC version 1.0.1 Index]