#' computeWerDists
#'
-#' Compute the WER distances between the synchrones curves (in columns), which are
-#' returned (e.g.) by \code{computeSynchrones()}
+#' Compute the WER distances between the series at specified indices, which are
+#' obtaind by \code{getSeries(indices)}
#'
#' @param indices Range of series indices to cluster
#' @inheritParams claws
#'
#' @export
computeWerDists <- function(indices, getSeries, nb_series_per_chunk, smooth_lvl, nvoice,
- nbytes, endian, ncores_clust=1, verbose=FALSE, parll=TRUE)
+ nbytes, endian, ncores_clust=3, verbose=FALSE, parll=TRUE)
{
n <- length(indices)
L <- length(getSeries(1)) #TODO: not very neat way to get L
{
if (parll)
{
- require("bigmemory", quietly=TRUE)
- require("Rwave", quietly=TRUE)
+ # parallel workers start with an empty environment
require("epclust", quietly=TRUE)
}
if (parll)
{
# parallel workers start with an empty environment
- require("bigmemory", quietly=TRUE)
require("epclust", quietly=TRUE)
Xwer_dist <- bigmemory::attach.big.matrix(Xwer_dist_desc)
}
cwt_j <- getCWT(j, L)
# Compute the ratio of integrals formula 5.6 for WER^2
- # in https://arxiv.org/abs/1101.4744v2 ยง5.3
+ # in https://arxiv.org/abs/1101.4744v2 paragraph 5.3
num <- filterMA(Mod(cwt_i * Conj(cwt_j)), smooth_lvl)
WY <- filterMA(Mod(cwt_j * Conj(cwt_j)), smooth_lvl)
wer2 <- sum(colSums(num)^2) / sum(colSums(WX) * colSums(WY))
if (parll)
{
# outfile=="" to see stderr/stdout on terminal
- cl <- parallel::makeCluster(ncores_clust, outfile="")
+ cl <-
+ if (verbose)
+ parallel::makeCluster(ncores_clust, outfile="")
+ else
+ parallel::makeCluster(ncores_clust)
Xwer_dist_desc <- bigmemory::describe(Xwer_dist)
parallel::clusterExport(cl, varlist=c("parll","nb_cwt_per_chunk","n","L",
"Xwer_dist_desc","noctave","nvoice","getCWT"), envir=environment())