projects
/
valse.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
work on constructionModeles + main (2 levels or //isation)
[valse.git]
/
pkg
/
tests
/
testthat
/
helper-clustering.R
1
# Compute the sum of (normalized) sum of squares of closest distances to a medoid.
2
computeDistortion <- function(series, medoids)
3
{
4
n <- ncol(series)
5
L <- nrow(series)
6
distortion <- 0.
7
for (i in seq_len(n))
8
distortion <- distortion + min( colSums( sweep(medoids,1,series[,i],'-')^2 ) / L )
9
10
sqrt( distortion / n )
11
}