Displaying 20 results from an estimated 3000 matches similar to: "kmeans"
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
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 number of clusters or a set of initial cluster
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
[38] 3 1 1 1 3 1 1 1 1 3 3 3 1 1 1 1 1 1 3 1 3 1 1 3 1 1 1 1 3 1 1 1 1 1 1 3
2001 Mar 13
1
kmeans cluster stability
I'm doing kmeans partitioning on a small (n=26) dataset that has 5
variables. I noticed that if I repeatedly run the same command, the
cluster centers change and the cluster membership changes.
Using RW1022 under Windows NT & Windows 2000
>kmeans(pottery[,1:5], 4, 20)
[...snip]
$size
[1] 7 3 9 7
[...snip]
$size
[1] 7 10 4 5
[...snip]
$size
[1] 6 10 5 5
yields a different
2013 Jan 24
1
Help regarding kmeans output. need to save the clusters into different directories/folders.
Hi Team,
I am trying to run kmeans in R, and I need to save the different clusters
into different folders. How can I achieve this?
# this is how my data looks.
$ *cat 1.tsv | head*
userid bookid rating bookTotalRatings bookAvgRating
userTotalRatings userAvgRating
1 100 0 24 2.7916666666666665 291 2.6735395189003435
2 200 7 24 2.9583333333333335 6 7.0
2010 Aug 18
1
Plotting K-means clustering results on an MDS
Hello All,
I'm having some trouble figuring out what the clearest way to plot my
k-means clustering result on an my existing MDS.
First I performed MDS on my distance matrix (note: I performed k-means on
the MDS coordinates because applying 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
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(...) the problem can be solved.
2007 Dec 05
1
Information criteria for kmeans
Hello,
how is, for example, the Schwarz criterion is defined for kmeans? It should
be something like:
k <- 2
vars <- 4
nobs <- 100
dat <- rbind(matrix(rnorm(nobs, sd = 0.3), ncol = vars),
matrix(rnorm(nobs, mean = 1, sd = 0.3), ncol = vars))
colnames(dat) <- paste("var",1:4)
(cl <- kmeans(dat, k))
schwarz <- sum(cl$withinss)+ vars*k*log(nobs)
Thanks
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.max= 1000, nstart =10000))
Q2) When I
2003 Feb 13
1
k- means cluster analysis
Hi all,
I am trying to run the k-means cluster analysis using the function kmeans
in the package cluster.
The data are:
x = c(-0.26, -0.23, -0.05, -0.20, 0.30, -0.84, -0.10, -0.12, 0.10, -0.31,
-0.19, 0.18, -0.26,
-0.23, -0.37, -0.23)
I've got two different solutions when I ran this function over a few times:
kmeans(x, centers=2)
The first solution gives the following:
$cluster
[1]
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
2006 Apr 05
1
"partitioning cluster function"
Hi All,
For the function "bclust"(e1071), the argument "base.method" is
explained as "must be the name of a partitioning cluster function
returning a list with the same components as the return value of
'kmeans'.
In my understanding, there are three partitioning cluster functions in
R, which are "clara, pam, fanny". Then I check each of them to
2012 Jun 27
1
Error: figure margins too large
Hello,
I am running cluster analysis, and am attempting to create a graph of my clusters. I keep on getting an error that says that my figure margins are too large.
d <- file.choose()
d <- read.csv(d,header=TRUE)
mydataS <- scale(d, center = TRUE, scale=TRUE)
#Converts mydataS from a matrix to a data frame
mydataS2 <- as.data.frame(mydataS)
#removes "coden"
2012 Jan 14
1
Error: unexpected '<' in "<" when modifying existing functions
Hi.
I am trying to modify kmeans function.
It seems that is failing something obvious with the workspace.
I am a newbie and here is my code:
myk = function (x, centers, iter.max = 10, nstart = 1, algorithm =
c("Hartigan-Wong",
+ "Lloyd", "Forgy", "MacQueen"))
+ {
+ do_one <- function(nmeth) {
+ Z <- switch(nmeth, {
+ Z
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
incorporate this, i tried using the R
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
------------
[R] Empty
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.
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
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$colCandInd
y = colCandList$colCandMed
m = matrix(c(x, y),
2009 Jul 20
2
kmeans.big.matrix
Hi,
I'm playing around with the 'bigmemory' package, 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