X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=epclust%2Ftests%2Ftestthat%2Fhelper.clustering.R;fp=epclust%2Ftests%2Ftestthat%2Fhelper.clustering.R;h=0000000000000000000000000000000000000000;hb=40f12a2f66d06fd77183ea02b996f5c66f90761c;hp=f39257e2b61df891ec37d5f36caee93cd170e1c8;hpb=a52836b23adb4bfa6722642ec6426fb7b5f39650;p=epclust.git diff --git a/epclust/tests/testthat/helper.clustering.R b/epclust/tests/testthat/helper.clustering.R deleted file mode 100644 index f39257e..0000000 --- a/epclust/tests/testthat/helper.clustering.R +++ /dev/null @@ -1,18 +0,0 @@ -# Shorthand: map 1->1, 2->2, 3->3, 4->1, ..., 149->2, 150->3, ... (is base==3) -I = function(i, base) - (i-1) %% base + 1 - -# Compute the sum of (normalized) sum of squares of closest distances to a medoid. -# Note: medoids can be a big.matrix -computeDistortion = function(series, medoids) -{ - if (bigmemory::is.big.matrix(medoids)) - medoids = medoids[,] #extract standard matrix - - n = ncol(series) ; L = nrow(series) - distortion = 0. - for (i in seq_len(n)) - distortion = distortion + min( colSums( sweep(medoids,1,series[,i],'-')^2 ) / L ) - - sqrt( distortion / n ) -}