+ skip("Unexplained failure")
+
+ # Same 60 reference sinusoïdal series than in clusteringTask1 test,
+ # but this time we consider them as medoids - skipping stage 1
+ # Here also we sample 900 series around the 60 "medoids"
+ n = 900
+ x = seq(0,9.5,0.1)
+ L = length(x) #96 1/4h
+ K1 = 60
+ K2 = 3
+ #for (i in 1:60) {plot(x^(1+i/30)*cos(x+i),type="l",col=i,ylim=c(-50,50)); par(new=TRUE)}
+ s = lapply( seq_len(K1), function(i) x^(1+i/30)*cos(x+i) )
+ series = matrix(nrow=L, ncol=n)
+ for (i in seq_len(n))
+ series[,i] = s[[I(i,K1)]] + rnorm(L,sd=0.01)
+
+ getRefSeries = function(indices) {
+ indices = indices[indices <= n]
+ if (length(indices)>0) as.matrix(series[,indices]) else NULL
+ }
+
+ # Perfect situation: all medoids "after stage 1" are good.
+ medoids_K1 = bigmemory::as.big.matrix( sapply( 1:K1, function(i) s[[I(i,K1)]] ) )
+ algoClust2 = function(dists,K) cluster::pam(dists,K,diss=TRUE)$id.med
+ medoids_K2 = clusteringTask2(medoids_K1, K2, algoClust2, getRefSeries,
+ n, 75, 4, 8, "little", verbose=TRUE, parll=FALSE)