File:Swiss cmeans.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 630 × 630 pixels, file size: 109 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
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
 
The SVG code is valid.
 
This chart was created with R.
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

[edit]
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.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current08:49, 2 October 2011Thumbnail for version as of 08:49, 2 October 2011630 × 630 (109 KB)Sigbert (talk | contribs)

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file: