# Questions tagged [k-means]

k-means is a method to partition data into clusters by finding a specified number of means, k, s.t. when data are assigned to clusters w/ the nearest mean, the w/i cluster sum of squares is minimized

227 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
632 views

### Can silhouette be calculated with distances to centroids, instead of pairwise point distances?

I am using Silhouette cluster validation for each repetition (for a specific K) of k-means, k-modes and k-medoids. All the definitions of Silhouette I see calculate the distance of each point to ...
1k views

### Pearson's Correlation Coefficient as a clustering criterion: why should it be close to -1?

Let's say we have a dataset $x = (x_1, x_2, ..., x_n)$ where each data point is assigned to one of $m$ clusters. Let $D = \{d_{ij}\}$ be the $n\times n$ distance matrix where $d_{ij} = d(x_1, x_j)$. ...
19k views

### k-means clustering why sum of squared errors (why k-medoids not)?

K-means clustering uses the sum of squared errors (SSE) $E = \sum\limits_{i=1}^k \sum\limits_{p \in C_i} (p-m_i)^2$ (with k clusters, C the set of objects in a cluster, m the center point of a ...
31 views

### Is my variable considered okay to use in k-means clustering with Euclidean distance?

I was wondering if I can use regular kmeans() in R with my variable "number of drug prescriptions" which equals a number between 1-25. From what I've read k-means ...
157 views

### k-means clustered data: how to label newly incoming data

I have a data set with labels that were produced by a k-means clustering algorithm. Now there is some data (with the same data structure) from another source and I wonder what is the most sensible way ...
575 views

### Clustering a set of curves

I am working with a MRI dataset where we inject dye into a person's wrist and measure intensity per time on a voxel-by-voxel basis. I am trying to determine if it is possible to identify certain ...
627 views

### If I want to do PCA before k - means, is it mandatory to do it for all variables?

I have 10 variables and some of them are highly correlated. So before I do k - means, I want to get lower number of variables that are not correlated, but retain as much information as possible. Thus, ...
68 views

### How to check whether there are any clusters in data?

In short: I am using k-means clustering with correlation distance. How to check, how many clusters should be used, if any? There are many indices and answers on how to establish a number of clusters ...
156 views

### How to deal with variability in clustering. Multiple/Meta clustering?

I'm not sure what information is relevant here, so here is some background: I'm using Python 3 / sklearn, but I could probably use R if needed. I have a small sparse data-set (~1500 samples, ~1600 ...
681 views

### Why does Kernel K-means work better than spectral clustering in this case?

I want to cluster a dataset using spectral clustering. Assuming $X$ is $d \times n$ data matrix as $n$ is the number of data samples. I construct a directed Adjacency matrix $W, n \times n$ in which ...
210 views

### Convergence of k-means or EM on Mixture of Gaussians

There are many algorithms for learning mixture of Gaussians but typically k-means/EM is used in practice. My question is related to the performance of k-means/EM for MoG. Recently, I came across this ...
70 views

### Adding weights to functions not accepting weights

If I had a vector of weights for each observation data(iris) wghts <- abs(rnorm(nrow(iris))) And I had a function that did not accept weights as an argument: ...
6k views

### K-Means Clustering with Dummy Variables

I want to use k-means to cluster my data. I have broken one column into 4 dummy variables and I have normalized all of the data to mean=0 and sd=1. Will k-means work with these dummy variables? I ...
8k views

### R: silhouette with k-means

I'm currently checking some clustering evaluation indexes in R, and now I'm using Silhouette and its respective function in R, "silhouette" (in "cluster" package). To test the method, I used the ...
503 views

### Need a little help understanding K-means++ seeding

I have been working on a project that involves using K-means clustering for generating adaptive palettes from images. I understand the general process of K-means clustering, and I understand the ...
273 views

6 views

### Dimension reduction - doing a PCA on the coordinates of a MCA

I have a dataset with 25 continuous variables and 2 categorical variables. I want to perform k-means clustering, so as a previous step I am performing a multiple correspondence analysis on the ...
28 views

### Modifying k-means for points on torus

My data coordinates are degrees so each axis has values [-180, 180]. Therefore it's easy to spot that in fact the scatter plot on the right end continues on the left side and the same thing for up and ...
54 views

### K-Means clustering: optimal clusters for common data sets

I use scikit-learn to get IRIS and WINE clusters for evaluating an algorithm for K-means clustering. The K-means algorithm is a heuristic algorithm for solving the "minimum-sum-of-squares-clustering (...
106 views

### K-means gives non-spherical clusters

I am trying to cluster 24 month utilization behaviors of customers using sklearn/K-means in python. When I plot the customers by clusters in a 2-D space (Principal Components 1 and 2 of my 24-point ...
110 views

### Why does kmeans after SVD result in ideal clusters

I am clustering tweets which are related to eye fashion and they are extracted using keywords like mascara, eyeliner, eyeshadow, etc from twitter. I constructed a Tf-idf matrix (tweets x words) ...
16 views

### Graph clustering for balanced sum of absolute deviations within each cluster (same sum of intracluster distances)

I'm given a set of points and a distance matrix. With these I'm trying to develop an algorithm similar to k-means that tries to minimize the sum of distances from each cluster datapoint to it's center ...
665 views

### How to determine the best batch-size value for Mini Batch K-means algorithm?

I am working on a project where I apply k-means on severals datasets. These datasets may include up to several billion points. I would like to use mini batch k-means to save time. However, the mini ...
91 views

### Apply K-means to the columns of the covariance matrix

In Section 5.3 of the paper distilling the knowledge in a neural network, it says we apply a clustering algorithm to the covariance matrix of the predictions of our generalist model, so that a set ...
15 views

### k-means and (re?) standardisation of a sub-set

I have data which is customer purchases of items in each of three months: I have summed the data over the three months for each customer; calculated the proportion of purchases that each item ...
405 views

### Grouping similar time series (clustering, cointegration)

I have a number of time series' that I am effectively trying to understand which are similar and which can be grouped together. I have some idea of what should be grouped with each other but I am also ...
37 views

### Why using L-method with CH and SIL for number of cluster selection?

In this paper, the author uses CH (Caliński–Harabasz index) and SIL (Silhouette index) methods to decide the number of clusters. However, instead of selecting the highest values, it applies a L-...
173 views

### Are my cluster means significantly different?

I have just performed a K-means clustering analysis on 43 variables and as a result I have 2 cluster. Now I want to test if the cluster means for each variable are significantly different between the ...