X-Git-Url: https://git.auder.net/?p=epclust.git;a=blobdiff_plain;f=epclust%2FR%2Fclustering.R;h=a8f1d3e705a42bbe5fdee78ff2820e118f68d7ab;hp=b91d512b23b6b1cd82eb4f8689e96ea44448b420;hb=282342bafdc9ff65c5df98c6e2304d63b33b9fb2;hpb=3c5a4b0880db63367a474a568e1322b3999932fe diff --git a/epclust/R/clustering.R b/epclust/R/clustering.R index b91d512..a8f1d3e 100644 --- a/epclust/R/clustering.R +++ b/epclust/R/clustering.R @@ -22,19 +22,20 @@ NULL #' @rdname clustering #' @export -clusteringTask1 = function(indices, getContribs, K1, algoClust1, nb_items_clust, +clusteringTask1 <- function(indices, getContribs, K1, algoClust1, nb_items_clust, ncores_clust=1, verbose=FALSE, parll=TRUE) { if (parll) { - cl = parallel::makeCluster(ncores_clust, outfile = "") + # outfile=="" to see stderr/stdout on terminal + cl <- parallel::makeCluster(ncores_clust, outfile = "") parallel::clusterExport(cl, c("getContribs","K1","verbose"), envir=environment()) } # Iterate clustering algorithm 1 until K1 medoids are found while (length(indices) > K1) { # Balance tasks by splitting the indices set - as evenly as possible - indices_workers = .splitIndices(indices, nb_items_clust, min_size=K1+1) + indices_workers <- .splitIndices(indices, nb_items_clust, min_size=K1+1) if (verbose) cat(paste("*** [iterated] Clustering task 1 on ",length(indices)," series\n", sep="")) indices <- @@ -60,8 +61,8 @@ clusteringTask1 = function(indices, getContribs, K1, algoClust1, nb_items_clust, #' @rdname clustering #' @export -clusteringTask2 = function(indices, getSeries, K2, algoClust2, nb_series_per_chunk, - nvoice, nbytes, endian, ncores_clust=1, verbose=FALSE, parll=TRUE) +clusteringTask2 <- function(indices, getSeries, K2, algoClust2, nb_series_per_chunk, + smooth_lvl, nvoice, nbytes, endian, ncores_clust=1, verbose=FALSE, parll=TRUE) { if (verbose) cat(paste("*** Clustering task 2 on ",length(indices)," medoids\n", sep="")) @@ -70,8 +71,8 @@ clusteringTask2 = function(indices, getSeries, K2, algoClust2, nb_series_per_chu return (indices) # A) Compute the WER distances (Wavelets Extended coefficient of deteRmination) - distances = computeWerDists(indices, getSeries, nb_series_per_chunk, - nvoice, nbytes, endian, ncores_clust, verbose, parll) + distances <- computeWerDists(indices, getSeries, nb_series_per_chunk, + smooth_lvl, nvoice, nbytes, endian, ncores_clust, verbose, parll) # B) Apply clustering algorithm 2 on the WER distances matrix if (verbose)