Questions tagged [k-means]

k-means is a clustering algorithm, implemented in popular data science tools. Use this tag for questions related to the k-means clustering algorithm itself, or to its use with the tools that implement it (alongside other tags specific to those tools).

In statistics and data mining, k-means clustering is a method of cluster analysis which aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean by least-squared deviations.

For detailed info check Wikipedia entry at http://en.wikipedia.org/wiki/K-means_clustering

3514 questions
1
vote
1 answer

Octave: Kmeans clustering not working on an image matrix

I have tried the following code. img=imread("test1.jpg"); gimg=rgb2gray(img); imshow(gimg); bw = gimg < 255; L = bwlabel(bw); imshow(label2rgb(L, @jet, [.7 .7 .7])) s = regionprops(L, 'PixelIdxList', 'PixelList'); s(1).PixelList(1:4, :) idx =…
1
vote
1 answer

How does sklearn.cluster.KMeans handle an init ndarray parameter with missing centroids (available centroids less than n_clusters)?

In Python sklearn KMeans (see documentation), I was wondering what happens internally when passing an ndarray of shape (n, n_features) to the init parameter, When n
belas
  • 277
  • 4
  • 17
1
vote
1 answer

3D SIFT for human activity classification in videos. NOT GETTING GOOD ACCURACY.

I am trying to classify human activities in videos(six classes and almost 100 videos per class, 6*100=600 videos). I am using 3D SIFT(both xy and t scale=1) from UCF. for f= 1:20 f offset =…
Sourabh
  • 53
  • 7
1
vote
1 answer

Is it possible for K Mean cluster has no member?

I'm currently using K Mean for clustering files. Some question occur to me, is it possible that the cluster has no member at all? If so, what is happen to the centroid of the cluster? Is it equal as the value before? Thanks
Achid
  • 13
  • 2
1
vote
1 answer

I get inconsistent results with Accord.Net K-Means classification

I have a test program that does not give consistent results for Accord.Net K-Means. I am enclosing a reproducible test program that can be run in Visual Studio 2013. The program is a console application and to reproduce the results you need to…
1
vote
0 answers

Visualize multi attribute data in a 2D plane

I have a dataset having 32 attributes. I am applying K-Means clustering on the dataset to find out the clusters. Now I want to visualize the data points. The challenge in visualization of these points is we have to convert this multidimensional data…
1
vote
0 answers

Square error clustering for Texture Segmentation

I am doing Texture Segmentation in Images Using Gabor Filters. I have generated Feature images and now i want to cluster them using square clustering or K-means. Since i am working in MATLAB, I am using the matlab defined functions. The official…
1
vote
2 answers

K-means clustering on text data?

For simpler understanding I am explaining with smaller example. I have 2 sets : I have 10 unique string ids. id1,id2,id3,id4,id5... id10 I have 3 unique c-ids: cid1,cid2,cid3 There is a mapping between 2 sets but not within the values of same…
user2793286
  • 179
  • 2
  • 14
1
vote
3 answers

arranging the values of vector to lists in Python

I'm running k-means algorithm on my data, I have the output of the labels looks like this: [0 5 8 6 1 3 3 2 2 5 5 6 1 1 3 3 1 8 8 3 3 1 1 1 1 5 2 5 1 1 7 3 6 4 3 3 8 1 3 3 5 1 8 8 1 8 7 1 1 8 6] This vector contains the cluster numbers for the…
genuis
  • 31
  • 1
  • 8
1
vote
0 answers

arranging my display of clusters

I'm running k-means clustering algorithm on data that is 3-D array, it looks this( for each year from 1910-2000, there is array of 51X 200 dimensions, those 51 are the states of US), this is the example of year 1916 for the only the first three…
Mark
  • 11
  • 4
1
vote
1 answer

Export kmeans clustering results to .csv

I've done a k-means clustering on my data, imported from .csv. Is there anyway to export the clustered results back to .csv file? Cos after the k-means clustering is done, the class of the variable is not a data frame but kmeans.
Anh Nguyen
  • 27
  • 2
  • 8
1
vote
2 answers

CPU gap when doing k-means with Spark

I am working with Spark 1.2.0. My feature vector is about 350 dimensions The data set is about 24k vectors The problem I described below only happens to kmeans|| algorithm; I have switched to kmeans-random for now, but I would like to know why…
David S.
  • 10,578
  • 12
  • 62
  • 104
1
vote
2 answers

Sklearn clustering similar orders

I have a dataset of restaurant invoices, containing the products ordered bye each client. I've already processed the data and I have the following matrix in csv file: InvoiceID, Product 1, product 2, product 3, product 4, product 5..... 123, …
andrepcg
  • 1,301
  • 7
  • 26
  • 45
1
vote
1 answer

OpenCV4Android Kmean doesn't work as expected

This code should give centers mat with 3 rows and clusterCount number of columns Mat reshaped_image = imageMat.reshape(1, imageMat.cols()*imageMat.rows()); Mat reshaped_image32f = new Mat(); reshaped_image.convertTo(reshaped_image32f,…
Ashok Varma
  • 3,489
  • 3
  • 28
  • 43
1
vote
1 answer

Cut off point in k-means clustering in sas

So I want to classify my data into clusters with cut-off point in SAS. The method I use is k-means clustering. (I don't mind about the method, as long as, it gives me 3 groups.) My code for clustering: proc fastclus data=maindat outseed=seeds1…
devon
  • 321
  • 2
  • 10
1 2 3
99
100