aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--measures.R4
1 files changed, 2 insertions, 2 deletions
diff --git a/measures.R b/measures.R
index 1b9128f..99aa4df 100644
--- a/measures.R
+++ b/measures.R
@@ -65,11 +65,11 @@ silhouette <- function(Dy, labels) {
for (i in 1:n) {
label <- labels[i]
- cohesion[i] <- mean(Dy[i, labels[-i] == label])
separation[i] <- min(Dy[i, labels != label])
+ cohesion[i] <- mean(Dy[i, labels[-i] == label])
}
- silh <- (cohesion - separation) / max(cohesion, separation)
+ silh <- (separation - cohesion) / max(separation, cohesion)
}
d2p <- function(D, perplexity = 9, tol = 1e-5, max.tries = 50) {