search for: kmean

Displaying 20 results from an estimated 258 matches for "kmean".

Did you mean: mean
2010 Aug 18
1
Plotting K-means clustering results on an MDS
...ing a euclidean distance measure to my raw data would have been inappropriate) canto.MDS<-cmdscale(canto) I then figured out what would be my optimum k-value by plotting the within sums of squares for K1-K15 > wss <- (nrow(canto.MDS)-1)*sum(apply(canto.MDS,2,var)) > wss[2] <- sum(kmeans(canto.MDS,centers=2)$withinss) > wss[3] <- sum(kmeans(canto.MDS,centers=3)$withinss) > wss[4] <- sum(kmeans(canto.MDS,centers=4)$withinss) > wss[5] <- sum(kmeans(canto.MDS,centers=5)$withinss) > wss[6] <- sum(kmeans(canto.MDS,centers=6)$withinss) > wss[7] <- sum(...
2011 Apr 06
2
Help in kmeans
Hi All, I was using the following command for performing kmeans for Iris dataset. Kmeans_model<-kmeans(dataFrame[,c(1,2,3,4)],centers=3) This was giving proper results for me. But, in my application we generate the R commands dynamically and there was a requirement that the column names will be sent instead of column indices to the R commands.Hence, to in...
2003 Jun 05
1
kmeans (again)
Regarding a previous question concerning the kmeans function I've tried the same example and I also get a strange result (at least according to what is said in the help of the function kmeans). Apparently, the function is disregarding the initial cluster centers one gives it. According to the help of the function: centers: Either the numb...
2004 Mar 18
2
don't stop when error occurs
Look up ?try Regards Wayne -----Original Message----- From: pastaska1934 [mailto:pastaska1934@free.fr] Sent: 18 March 2004 14:36 To: R-help@stat.math.ethz.ch Subject: [R] don't stop when error occurs hi, i'm doing some bootstraping on a data set, using kmeans for each bootstrap, i mean i do a loop(200 times) and in each loop i use kmeans. i have to count some occurences in a matrix result, but somentimes kmeans fail, cause of the algorithm. so i would like to avoid my function to stop on kmeans error is there a way to do such a thing? like if(kmeans()=...
2006 Jul 09
2
distance in kmeans algorithm?
Hello. Is it possible to choose the distance in the kmeans algorithm? I have m vectors of n components and I want to cluster them using kmeans algorithm but I want to use the Mahalanobis distance or another distance. How can I do it in R? If I use kmeans, I have no option to choose the distance. Thanks in advance, Arnau.
2013 Mar 13
1
Empty cluster / segfault using vanilla kmeans with version 2.15.2
Hello, here is a working reproducible example which crashes R using kmeans or gives empty clusters using the nstart option with R 15.2. library(cluster) kmeans(ruspini,4) kmeans(ruspini,4,nstart=2) kmeans(ruspini,4,nstart=4) kmeans(ruspini,4,nstart=10) ?kmeans either we got empty always clusters and or, after some further commands an segfault. regards, Detlef Groth...
2006 Aug 07
5
kmeans and incom,plete distance matrix concern
Hi there I have been using R to perform kmeans on a dataset. The data is fed in using read.table and then a matrix (x) is created i.e: [ mat <- matrix(0, nlevels(DF$V1), nlevels(DF$V2), dimnames = list(levels(DF$V1), levels(DF$V2))) mat[cbind(DF$V1, DF$V2)] <- DF$V3 This matrix is then taken and a distance matrix (y) created using dis...
2004 May 28
6
distance in the function kmeans
Hi, I want to know which distance is using in the function kmeans and if we can change this distance. Indeed, in the function pam, we can put a distance matrix in parameter (by the line "pam<-pam(dist(matrixdata),k=7)" ) but we can't do it in the function kmeans, we have to put the matrix of data directly ... Thanks in advance, Nicolas BOUGET
2004 May 11
1
AW: Probleme with Kmeans...
Sorry, to solve your question I had tried: data(faithful) kmeans(faithful[c(1:20),1],10) Error: empty cluster: try a better set of initial centers But when I run this a second time it will be ok. It seems, that kmeans has problems to initialize good starting points, because of the random choose of these starting initial points. With kmeans(data,k,centers=c(....
2006 Apr 07
2
cclust causes R to crash when using manhattan kmeans
Dear R users, When I run the following code, R crashes: require(cclust) x <- matrix(c(0,0,0,1.5,1,-1), ncol=2, byrow=TRUE) cclust(x, centers=x[2:3,], dist="manhattan", method="kmeans") While this works: cclust(x, centers=x[2:3,], dist="euclidean", method="kmeans") I'm posting this here because I am not sure if it is a bug. I've been searching for a manhattan kmeans method and I found a solution by using the package amap: require(amap) Kmea...
2012 Feb 27
2
kmeans: how to retrieve clusters
Hello, I'd like to classify data with kmeans algorithm. In my case, I should get 2 clusters in output. Here is my data colCandInd colCandMed 1 82 2950.5 2 83 1831.5 3 1192 2899.0 4 1193 2103.5 The first cluster is the two first lines the 2nd cluster is the two last lines Here is the code: x = colCandList$colCandIn...
2003 Apr 14
2
kmeans clustering
Hi, I am using kmeans to cluster a dataset. I test this example: > data<-matrix(scan("data100.txt"),100,37,byrow=T) (my dataset is 100 rows and 37 columns--clustering rows) > c1<-kmeans(data,3,20) > c1 $cluster [1] 1 1 1 1 1 1 1 3 3 3 1 3 1 3 3 1 1 1 1 3 1 3 3 1 1 1 3 3 1 1 3 1 1 1 1 3 3...
2010 May 05
2
custom metric for dist for use with hclust/kmeans
Hi guys, I've been using the kmeans and hclust functions for some time now and was wondering if I could specify a custom metric when passing my data frame into hclust as a distance matrix. Actually, kmeans doesn't even take a distance matrix; it takes the data frame directly. I was wondering if there's a way or if there'...
2005 Mar 31
2
Using kmeans given cluster centroids and data with NAs
...ed the functions agnes and cutree to cluster my data (4977 objects x 22 variables) into 8 clusters. I would like to refine the solution using a k-means or similar algorithm, setting the initial cluster centres as the group means from agnes. However my data matrix has NA's in it and the function kmeans does not appear to accept this? > dim(centres) [1] 8 22 > dim(data) [1] 4977 22 > x <- kmeans(data,centres) Error in kmeans(data, centres) : NA/NaN/Inf in foreign function call (arg 1) I have looked extensively through the mail archives but cannot find if/where someone has provi...
2009 Jul 20
2
kmeans.big.matrix
...kage, and I have finally managed to create some really big matrices. However, only now I realize that there may not be functions made for what I want to do with the matrices... I would like to perform a cluster analysis based on a big.matrix. Googling around I have found indications that a certain kmeans.big.matrix() function should exist. It is mentioned, among other places, in this document: http://www.stat.yale.edu/~jay/662/bm-nojss.pdf Unfortunately, on my computer the following happens: > require(bigmemory) Loading required package: bigmemory > kmeans.big.matrix Error: object 'km...
2012 Aug 28
1
K-Means clustering Algorithm
I was wondering if there was an R equivalent to the two phased approach that MATLAB uses in performing the Kmeans algorithm. If not is there away that I can determine if the kmeans in R and the kmeans in MATLAB are essentially giving me the same clustering information within a small amount of error? -- View this message in context: http://r.789695.n4.nabble.com/K-Means-clustering-Algorithm-tp4641626.html...
2008 Jun 18
3
[LLVMdev] JIT bug?
Hi, I see sth that to me looks like a JIT bug. The program is the KMeans benchmark from the STAMP benchmark suite (http://stamp.stanford.edu). Overwrite ./common/Defines.common.mk with the attached files to make CC/LD customizable. in ./kmeans, for ./kmeans -m40 -n40 -t0.00001 -i inputs/random-n65536-d32-c16.txt -p 1 : make -f Makefile.seq clean CC='llvm-gcc&...
2013 Jun 24
1
K-means results understanding!!!
Dear members. I am having problems to understand the kmeans- results in R. I am applying kmeans-algorithms to my big data file, and it is producing the results of the clusters. Q1) Does anybody knows how to find out in which cluster (I have fixed numberofclusters = 5 ) which data have been used? COMMAND (kmeans.results <- kmeans(mydata,centers =5, iter...
2003 Jun 06
1
Kmeans again
Dear helpers I'm sorry to insist but I still think there is something wrong with the function kmeans. For instance, let's try the same small example: > dados<-matrix(c(-1,0,2,2.5,7,9,0,3,0,6,1,4),6,2) I will choose observations 3 and 4 for initial centers and just one iteration. The results are > A<-kmeans(dados,dados[c(3,4),],1) > A $cluster [1] 1 1 1 1 2 2 $centers [,...
2005 Jun 14
1
KMEANS output...
Using R 2.1.0 on Windows 2 questions: 1. Is there a way to parse the output from kmeans within R? 2. If the answer to 1. is convoluted or impossible, how do you save the output from kmeans in a plain text file for further processing outside R? Example: > ktx<-kmeans(x,12, nstart = 200) I would like to parse ktx within R to extract cluster sizes, sum-of-squares values, etc., O...