#' @param getContribs Function to retrieve contributions from initial series indices:
#' \code{getContribs(indices)} outpus a contributions matrix
#' @param contribs matrix of contributions (e.g. output of \code{curvesToContribs()})
+#' @param distances matrix of K1 x K1 (WER) distances between synchrones
#' @inheritParams computeSynchrones
#' @inheritParams claws
#'
synchrones = computeSynchrones(medoids,
getRefSeries, nb_ref_curves, nb_series_per_chunk, ncores_clust, verbose, parll)
distances = computeWerDists(synchrones, ncores_clust, verbose, parll)
- # PAM in package 'cluster' cannot take big.matrix in input: need to cast it
- medoids[ computeClusters2(distances[,],K2,verbose), ]
+ medoids[ computeClusters2(distances,K2,verbose), ]
}
#' @rdname clustering
}
indices_workers = .spreadIndices(seq_len(nb_ref_curves), nb_series_per_chunk)
- browser()
+#browser()
ignored <-
if (parll)
parallel::parLapply(cl, indices_workers, computeSynchronesChunk)
#' as the series in the initial dataset
#' @inheritParams claws
#'
-#' @return A big.matrix of size K1 x K1
+#' @return A matrix of size K1 x K1
#'
#' @export
computeWerDists = function(synchrones, ncores_clust=1,verbose=FALSE,parll=TRUE)
sqres / max(Mod(sqres))
}
+ # Distance between rows i and j
computeDistancesIJ = function(pair)
{
i = pair[1] ; j = pair[2]
parallel::stopCluster(cl)
Xwer_dist[n,n] = 0.
- Xwer_dist
+ distances <- Xwer_dist[,]
+ rm(Xwer_dist) ; gc()
+ distances #~small matrix K1 x K1
}
# Helper function to divide indices into balanced sets