File:Swiss cmeans.svg

Summary

Description
English: Fuzzy C-Means result of the Swiss Banknote data (visualized on the first and second principal component)
Date
Source Own work
Author Sigbert
SVG development
InfoField
Source code
InfoField

R code

library("foreign")
 library("e1071")
 x   <- read.spss("BANK2.sav", to.data.frame=T)
 pca <- prcomp(data.matrix(x))
 set.seed(0)
 k   <- 2
 # k-Means
 km <- kmeans(x, k)
 mc  <- c("red", "blue")
 svg("swiss_kmeans.svg")
 plot(pca$x[,1], pca$x[,2], pch=19, col=mc[km$cluster], cex=0.8,
       xlab="First principal component", ylab="Second principal component",
       main="k-Means")
 center <- (km$centers-matrix(pca$center, nc=6, nr=2, byrow=T))%*%pca$rotation[,1:2]
 points(center, col=mc, pch="+", cex=2)
 points(center, col=mc, cex=2)
 dev.off()
 # Fuzzy C-Means
 fcm <- cmeans(x, k)
 size <- 0.8*apply(fcm$membership, 1, max)
 svg("swiss_cmeans.svg")
 plot(pca$x[,1], pca$x[,2], pch=19, col=mc[fcm$cluster], cex=size,
       xlab="First principal component", ylab="Second principal component",
       main="Fuzzy C-Means")
 center <- (fcm$centers-matrix(pca$center, nc=6, nr=2, byrow=T))%*%pca$rotation[,1:2]
 points(center, col=mc, pch="+", cex=2)
 points(center, col=mc, cex=2)
 dev.off()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-3.0#Swiss%20cmeans.svg
Category:Self-published work Category:Scatterplots Category:Cluster analysis Category:Fuzzy logic#%3F Category:Banknotes of Switzerland Category:Counterfeit banknotes
Category:Banknotes of Switzerland Category:CC-BY-SA-3.0 Category:Cluster analysis Category:Counterfeit banknotes Category:Fuzzy logic Category:Scatterplots Category:Self-published work Category:Valid SVG created with R code