| woa_kmedoids | R Documentation |
This function implements the Whale Optimization Algorithm (WOA) for K-Medoids clustering. Supported distance measures are Dynamic Time Warping (DTW) and Euclidean Distance (ED).
woa_kmedoids(
data,
ClusNum,
distance_method = c("dtw", "ed"),
learned_w = NULL,
Max_iter = 200,
n = 5,
early_stopping = TRUE,
patience = 5,
verbose = FALSE
)
data |
Data matrix |
ClusNum |
Number of clusters |
distance_method |
Distance calculation method, either "dtw" or "ed" |
learned_w |
Window size for DTW (only used if distance_method is "dtw") |
Max_iter |
Maximum number of iterations (default is 200, it can be adjusted according to the size of the dataset) |
n |
Population size (number of whales, default is 5, it can be adjusted according to the size of the dataset) |
early_stopping |
Logical. If TRUE, stop early when the best solution converges (default is TRUE) |
patience |
Number of consecutive iterations without improvement before early stopping (default is 5) |
verbose |
Logical. If TRUE, print progress messages (default is FALSE) |
The 'woa_clustering' object containing the clustering result and medoids
Chenan Huang, Narumasa Tsutsumida
Chenan H. and Tsutsumida N. (2025) A scalable k-medoids clustering via whale optimization algorithm, Array, 28,100599. https://doi.org/10.1016/j.array.2025.100599.
# NOTE: This example only shows how to implement woa_kmedoids using sample data.
# Results do not suggest any meanings.
data(Lightning7)
Lightning7_data <- Lightning7[, -1] # Remove the first column of classification data
result <- woa_kmedoids(Lightning7_data, ClusNum = 7, distance_method = "dtw", learned_w = 5)
print(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.