Displaying 20 results from an estimated 11000 matches similar to: "beginners question - kmeans"
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
2004 Aug 19
5
column names in data.frame
Dear R-help,
Please can someone explain how to put a column name on an output data.frame.
##Starting with a data.frame with 3 columns (d$Year, d$NoIndiv, d$wtd_tl)
yr_ind <- split (d$NoIndiv, d$Year)
yr_tl <- split (d$wtd_tl, d$Year)
ann_ind <- sapply (yr_ind, sum)
ann_tl <- sapply (yr_tl, sum)
av_tl <- ann_tl/ann_ind
d2<- data.frame (av_tl)
##This gives me a data.frame
2004 Aug 26
2
labels on secondary y axis
Hi,
I have plotted a graph and used a secondary axis as follows:
plot (d$Year, d$HrFishing, type='l', col='1', xlab='Year', ylab='Effort
(hours/fishing)')
par(new=TRUE)
plot (d$Year, d$Landings, type='l', col='3', xlab='', ylab='')
axis(4)
However, if I put a label in the 2nd ylab='' it is placed over the 1st ylab,
on the
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
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.
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
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
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 Nov 10
1
kmeans error (bug?)
Hello,
I have been getting the following intermittent error from kmeans:
>str(cavint.p.r)
num [1:1967, 1:13] 0.691 0.123 0.388 0.268 0.485 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:1967] "6" "49" "87" "102" ...
..$ : chr [1:13] "HYD" "NEG" "POS" "OXY" ...
> set.seed(34)
>
2000 Sep 14
1
Pl. provide and Input for Kmeans
Sir,
Would like to know what sort of input matrix are taken by the kmeans function
defined in mva library of R application. As per the documentation for the
Kmeans it takes the following 2 data sets:
1) data
2) centers
The commands to be executed in R are as follows:
library(mva)
data <- read.table('file1',header=TRUE,sep="\t")
centers <-
2003 Jun 03
1
kmeans
Dear helpers
I was working with kmeans from package mva and found some strange situations. When I run several times the kmeans algorithm with the same dataset I get the same partition. I simulated a little example with 6 observations and run kmeans giving the centers and making just one iteration. I expected that the algorithm just allocated the observations to the nearest center but think this
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
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
2005 Apr 01
4
error in kmeans
I am trying to generate kmean of 10 clusters for a 165 x 165 matrix.
i do not see any errors known to me. But I get this error on running the
script
Error: empty cluster: try a better set of initial centers
the commands are
M <-matrix(scan("R_mutual",n = 165 * 165),165,165,byrow = T)
cl <- kmeans(M,centers=10,20)
len = dim(M)[1]
....
....
I ran the same script last night and
2004 May 11
2
Probleme with Kmeans...
Hello,
I would like to have any help with the function Kmeans of R..
I use this to do a classification of my data...I have chosen 12 classes but, I have always an error message:
Error: empty cluster: try a better set of initial centers
So, I don't understand the probleme with this function..
Thank you to help me!!
All the Best
Clothilde
Clothilde Kussener
CNRS - CEBC
79360 Villiers en bois
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
2012 Feb 29
3
Does anyone knows a KMeans ++ package for R?
Dear all.
I am searching for KMeans ++ for R. I cannot find it.
Do you know any package with it?
Best regards,
Rui
2013 Feb 03
1
Empty cluster / segfault using vanilla kmeans with version 2.15.2
Dear experts,
I am encountering a version-dependent issue.
My laptop runs Ubuntu 12.04 LTS 64-bit, R 2.14.1; the issue explained below
never occurred with this version of R
My desktop runs Ubuntu 11.10 64-bit, R 2.13.2; what follows applies to this
setup.
The data I'm clustering is constituted by the rows of a 320 x 6 matrix
containing integers ranging from 1 to 7, no missing data.
I applied
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., OR save ktx in
2010 Dec 02
1
kmeans() compared to PROC FASTCLUS
Hello all,
I've been comparing results from kmeans() in R to PROC FASTCLUS in SAS and
I'm getting drastically different results with a real life data set. Even
with a simulated data set starting with the same seeds with very well
seperated clusters the resulting cluster means are still different. I was
hoping to look at the source code of kmeans(), but it's in C and FORTRAN and