# NOT RUN {
## load iris data
data(iris)
X = as.matrix(iris[,1:4])
label = as.factor(iris$Species)
## compare two initialization
out1 = do.sammon(X,ndim=2) # random projection
out2 = do.sammon(X,ndim=2,initialize="pca") # pca as initialization
## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2))
plot(out1$Y, pch=19, col=label, main="out1:rndproj")
plot(out2$Y, pch=19, col=label, main="out2:pca")
par(opar)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab