[R] package GeneSOM ?
Jun Yan
jyan at stat.wisc.edu
Wed Oct 3 16:59:34 CEST 2001
> But i miss or didn't find the possibility , extract the
> information from the SOMplot "clusterSize" and "mean" for every cluster as quantitative information ( i.e. the DataFrame with an additional column which
> define the calculate clusters from SOM)?
Within a som object, code is a matrix with nrow = xdim*ydim, each row
corresponding to a code vector of a cell in the map. The mapping from cell
coordinate (x, y) to the row index in the code matrix is:
rownumber = x + y * xdim
and hence (indexed from 0)
x = (rownumber - 1) %% xdim
y = (rownumber - 1) %/% xdim
The "mean" for each cluster is contained in the row of code.
The "clustersize" could be obtained by the following function
somsum <- function(obj) {
xdim <- obj$xdim
ydim <- obj$ydim
m <- nrow(obj$code)
x <- (1:m - 1) %% xdim
y <- (1:m - 1) %/% xdim
f <- function(ii) {
x <- (ii - 1) %% xdim
y <- (ii - 1) %/% xdim
ind <- obj$visual$x == x & obj$visual$y == y
n <- length(ind[ind])
n
}
nobs <- sapply(1:m, f)
data.frame(x, y, nobs)
}
The output from this function could be put side by side with code using
cbind.
> My intention - compare calculate SOM results with other unsupervised classification results !
>
> P.S. How i have got qerror to interpret ?
The qerror is calculated as an average of a weighted quantization error
for each sample:
\sum h_{ci} |x - m_i|^2
where the summation is taken over all the coding (mean) vector for the
sample, h_{ci} is the neighbouhood funcion, and m_i is the coding
vector. The default radius of neighbourhood is 1.
I am sorry it's not well documented. I will try to improve this over the
weekend.
Jun
> Thanks for advance & regards,
> Christian
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list