X-Git-Url: https://git.auder.net/?p=epclust.git;a=blobdiff_plain;f=epclust%2FR%2Fmain.R;h=f45c9450dab724258047c4161439f3adafc83718;hp=e7943517587e46abbace81bb5b6397628e72328a;hb=7b13d0c28da62d91684a29ced50c740120e2b7a9;hpb=d300b49cd63d0539d29bbee120fa8237f7acee9b diff --git a/epclust/R/main.R b/epclust/R/main.R index e794351..f45c945 100644 --- a/epclust/R/main.R +++ b/epclust/R/main.R @@ -40,7 +40,7 @@ epclust = function(data, K1, K2, ntasks=1, nb_series_per_chunk=50*K1, min_series_per_chunk=5*K1, wf="haar", WER="end", ncores_tasks=1, ncores_clust=4, random=TRUE) { - #0) check arguments + # Check arguments if (!is.data.frame(data) && !is.function(data)) { tryCatch( @@ -66,7 +66,7 @@ epclust = function(data, K1, K2, ntasks=1, nb_series_per_chunk=50*K1, min_series if (WER!="end" && WER!="mix") stop("WER takes values in {'end','mix'}") - #1) Serialize all wavelets coefficients (+ IDs) onto a file + # Serialize all wavelets coefficients (+ IDs) onto a file coeffs_file = ".coeffs" index = 1 nb_curves = 0 @@ -84,20 +84,15 @@ epclust = function(data, K1, K2, ntasks=1, nb_series_per_chunk=50*K1, min_series nb_coeffs = ncol(coeffs_chunk)-1 } -# finalizeSerialization(coeffs_file) ........, nb_curves, ) -#TODO: is it really useful ?! we will always have these informations (nb_curves, nb_coeffs) - if (nb_curves < min_series_per_chunk) stop("Not enough data: less rows than min_series_per_chunk!") nb_series_per_task = round(nb_curves / ntasks) if (nb_series_per_task < min_series_per_chunk) stop("Too many tasks: less series in one task than min_series_per_chunk!") - #2) Cluster coefficients in parallel (by nb_series_per_chunk) - # All indices, relative to complete dataset - indices = if (random) sample(nb_curves) else seq_len(nb_curves) - # Indices to be processed in each task - indices_tasks = list() + # Cluster coefficients in parallel (by nb_series_per_chunk) + indices = if (random) sample(nb_curves) else seq_len(nb_curves) #all indices + indices_tasks = list() #indices to be processed in each task for (i in seq_len(ntasks)) { upper_bound = ifelse( i