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

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

Initializing EM algortihm with kmean when means are the same

I have a set of point (in one dimension) of 2 types: -First type of point: generated with gaussian density with parameters (m1,sigma1) -Second type of point: generated with gaussian density with ...
0
votes
0answers
18 views

Why is it wrong to apply k-means to a distance matrix?

There are several threads discussing clustering analysis of a distance matrix and they dismiss use of the k-means algorithm. Here are two examples: Perform K-means (or its close kin) clustering with ...
0
votes
1answer
30 views

How to compare clustering results between “raw” and normalized data

I have a dataset and I would like to apply a clustering algorithm to find some groups. I do not have any label, so it is just wondering if I can find relevant clusters. If it may help, it is ...
0
votes
1answer
32 views

K-Means clustering - upper bound for number of iterations

Suppose we run the K-means clustering algorithm on a one-dimensional dataset, i.e. $p = 1$, so that each observation consists of a single real number. We assume that these real numbers are distinct. ...
0
votes
0answers
20 views

KMeans where there are clusters of data with different densities

Suppose we have $n$ data samples and they are grouped in two sets such that half of the data are in a high density region and the other half is in a low density region. These regions are apart from ...
0
votes
0answers
6 views

Automation of k-means for customer clustering

Im working on the project to cluster customers each month and the final idea is to create auto process (script) which will run the k-means so i can say - Cluster 0 - Loyals Cluster 1 - Active Cluster ...
1
vote
1answer
29 views

Discussing validity of tests performed after a cluster analysis

I'm new to datascience (from a medical/medical science background). My supervisor (social sciences background) asked me to assist in rewriting a paper where we do a cluster analysis for a ...
2
votes
2answers
36 views

Why is the clustering cost function called “distortion”?

Andrew Ng's excellent ML course on Coursera describes the k-means clustering algorithm and its cost function (roughly, the points' distance from their cluster centre), which he says is called "...
1
vote
2answers
40 views

How to make clusters (consisting of demands) equal to the load of a truck?

I am working on a routing problem where I have thousands of points (places) with individual demands (in Weight and Volume). So far I have created 5 clusters based on their location. Now I need to ...
1
vote
1answer
21 views

K-means random initialization: two centers at same point

I'm wondering how k-means deals with randomly initializing two centers (for two distinct observations x_1 and x_2, but with the ...
0
votes
0answers
5 views

K-means to Uncover Finite GMM Parameters in Population Case

Given a finite Gaussian mixture model with the number of distributions known, will k-means reveal the true mean parameters of each Gaussian in the infinite population case? I assume generally not, but ...
1
vote
0answers
13 views

Clustering algorithm which is guaranteed to converge to global minimum [duplicate]

Well known k-means algorithm is not guaranteed to converge to global minimum. It only converges to local minimum. So my question is, what are the clustering algorithms that are guaranteed to converge ...
0
votes
0answers
20 views

K-medians clustering WCS and BCS with Gmedian R package

I want to calculate the within-cluster sum of distances and between-cluster sum of distances for k-medians clustering. I see that the kGmedian function outputs the cluster centers and a vector of ...
0
votes
0answers
15 views

The total within sum of squares gradually decreases in K-means algorithm

Show that for K-means algorithm, $ \sum_{k=1}^K \sum_{i \in C_k} d(X_i,\bar{X_k}) \ge \sum_{j=1}^K \sum_{i \in C_j^\prime} d(X_i,\bar{X_j^\prime})$, where d is the squared Euclidean distance,$\bar{X_k}...
0
votes
0answers
22 views

What the difference between clustering methods?

I am focusing on a thesis for introducing clustering methods. Chapter 3 includes hierarchical clustering, partitional clustering and density-based clustering. Meanwhile, chapter 4 is mainly on Self-...
0
votes
1answer
27 views

The resulting image file is even larger than original when using K-means to do image compression

I am trying to compress jpeg file [Original Picture] [Compressed Picture with K-means using K=10] However, the original one is 85K while the compressed one is 101K? Here is the code I use: ...
1
vote
0answers
15 views

I don't understand why each time Kmeans finds the same centroid given different initialization?

The k-means algorithm does the following: Given a set of points, we first choose k random points to be the initial centroids. We then create k clusters. The ith cluster contains the points nearest to ...
0
votes
1answer
13 views

Can K-means be used to group data in win/lose categorical values for prediction purposes?

Currently I have a dataset with matches played by a team against other teams. Some of the variables are: kills, deads, assists, amountgold, amountdamagedone, result(win/lose). What I want to do is ...
2
votes
0answers
46 views

Perform clustering from a similarity matrix

I have a list of songs for each of which I have extracted a feature vector. I calculated a similarity score between each vector and stored this in a similarity matrix. I would like to cluster the ...
0
votes
1answer
21 views

How can one compute the “average” of a dataset of histograms that minimizes the mean Earth Mover's Distance between all data points and average?

It is my understanding that when the distance metric is euclidean distance, the mean of a dataset minimizes the average distance between all data points and the computed "mean". In the case ...
1
vote
1answer
19 views

Can the k-nearest neighbor algorithm tell you how many clusters there are among predictors?

I recently did a short course on machine learning in R and found the k-means and k-nearest neighbor techniques extremely interesting. Forgive my naivete if this is all wrong, but it seems like the ...
2
votes
0answers
19 views

How to perform cluster analysis on categorial data in R

I have survey data with 1000 respondents, each one has awnsered 20 questions related to different product features of a car. Each question could be awnsered as "good", "indifferent"...
0
votes
0answers
12 views

Proof of Identity for K-Means Clustering in ISLR

for exam preparations I am attempting all exercised in the ISLR book. The following I can not solve: Prove: $$\frac{1}{\vert C_k \vert} \sum_{i,i' \in C_k}\sum_{j=1}^p (x_{ij}-x_{i'j})^2 = 2 \sum_{i \...
1
vote
0answers
32 views

Precise definition of K-means

I am reading about K-means algorithm, and trying to explain it to myself in one sentence. However, I am a bit confused. I have came up with following definitions and I am not sure whether which one is ...
1
vote
1answer
46 views

How to assess the consistency of clustering

I am solving a clustering problem in which I am running the same algorithm 50 times. I know several scores aimed to select the best k, but I was wondering if there exist any score that measures the ...
0
votes
1answer
21 views

Weighting k-means with two attributes

I am aiming to use K-means to cluster lat-lon points, but I want to apply a weight to each point's distance based on two attributes of the point. Attribute 1 is population and attribute 2 is percent ...
1
vote
1answer
292 views

Confusion matrix for k-means algorithm

Using R, I ran the K-means algorithm on a dataset with 1m+ rows. Using elbow plot, the optimum no. of clusters was found to be 3. Now each data point is assigned a cluster from the set {1,2,3}. But I'...
1
vote
1answer
19 views

Does this shape one cluster? and why angles change every time i run the code?

I have data and tried to do clustering on it. every time I run the code with the below statements it changes the angle of the shape but still the same below shape ...
1
vote
0answers
21 views

K-means on a one-dimensional dataset [closed]

Given the data set $𝑋=\{−6,5,0,4,7\}$ and the cluster initialization $𝑉=\{ 5,6\}$ How would the cluster centers (i.e. means) look like after applying naive k-means(computing min. distance $|\cdot |$ ...
2
votes
1answer
57 views

Interpretation of Cluster Distortion on Normalized data

I have a clustering problem which I solved using KMeans clustering. I also know that the Elbow Method for cluster evaluation can be used to approximate a feasible pick for the number of clusters. I ...
1
vote
1answer
51 views

How do I analyze clustering post-PCA

I had in mind to cluster stocks based on some risk indicators such as VaR, sharpe ratio or variance. In a first instance I was thinking to cluster those data points and analyze the results, because ...
0
votes
0answers
8 views

Cluster analysis with dissimilar length sequences with text data

I am wondering how to do cluster analysis with dissimilar length sequences. When I do clustering (like k-means or k-mediods) it is clustering based on length. So it is not findings any groups or ...
0
votes
0answers
8 views

Can sombody interpret the explanation about Gap Statistic for Clustering?

The following content comes from the following site: [https://www.datanovia.com/en/lessons/determining-the-optimal-number-of-clusters-3-must-know-methods/][1] The algorithm works as follow: Cluster ...
0
votes
0answers
25 views

Can I use Customer ID or count(customer ID) in K means clustering? Also, how to find the data points that doesn't fit the clusters well(outliers)?

I am trying to cluster a large dataset with 150k observations. There are 4 variables: Customer ID, Type(credit/Debit), Amount and Country(4 levels). Usually, we don't use customer ID as it doesn't ...
0
votes
1answer
33 views

How to understand which is the optimal k number?

I have this plot but I would like to understand which is the optimal k number only by watching this. I already did the silhouette method and gap statistics, the first shows me optimal number equal to ...
0
votes
0answers
20 views

Hidden Markov Model library to study animal movement (preferably in R)

I want to describe the behaviour of whales using data of their vertical movement. Besides the time-depth profile of tagged whales, I calculated several variables for each dive performed (e.g. maximum ...
0
votes
0answers
34 views

Silhouette Coefficient acceptable value

Does anybody know about the acceptable values for Silhouette Coefficient (or maybe Calinski-Harabasz and Davies-Bouldin index) in K-means clustering?. I know that Silhouette Coefficients close to 1 ...
2
votes
0answers
33 views

Clustering text embeddings: TF-IDF + BERT Sentence Embeddings

I am trying to cluster a few thousand forum posts that are similar in content to Stackoverfow. So far, I have tried two main approaches to represent the posts: TF-IDF Sentence embedding based on BERT....
0
votes
0answers
11 views

While using Ward's method, should we always find optimal no. of clusters using Ward's method, then cluster by K means?

I have plant biomass and grain weight data for different plant varieties which I now need to cluster. I have performed Hierarchical clustering using Ward's method and squared Euclidean distance, ...
0
votes
0answers
10 views

Classification on aggregate data

I've been tasked with creating a model that can classify individual cases as either something to be flagged or not. However, the training data I have access to is only aggregate data, where each row ...
0
votes
0answers
26 views

Should one-dimensional data be normalized for K-Means clustering?

Data normalization is important prior to K-Means clustering when there are multiple variables in the clustered data set. Data centering and scaling (for instance using Z-score) can change the relative ...
0
votes
0answers
43 views

Add k-means layer to Keras model

I'm using a GAN to generate pixel-art images. The structure follow the Tensorflow tutorial on how to do GAN closely. My network outputs gradient-rich images, which look like down-scaled photos rather ...
0
votes
1answer
40 views

Find all possible clusterizations

I need help to find all possible clusterizations via the k-means method in Python. Let's assume for simplicity that I have the following table: height | weight | country of origin (X/Y/Z) | flag (1/0) ...
1
vote
1answer
45 views

How to avoid k-means to merge two groups of points into one cluster?

I've implemented a k-means clustering algorithm, but in some cases (~12%) a situation like that happened: In these cases, my algorithm is creating one cluster for both the yellow and blue group of ...
3
votes
1answer
70 views

Acceptable SSE (sum of squared errors) for K-means

I am developing a k-means clustering algorithm, and I have obtained the ideal number of clusters based on the elbow method. However, despite the fact that the error diminishes a lot with the number of ...
0
votes
0answers
20 views

Performing Discriminant Analysis after K-means clustering on the same data

Let's say I perform a k-means clustering analysis on my data and I find three distinct groups. Afterwards I perform a Discriminant analysis on the same data with the clustering from k-means as the ...
0
votes
1answer
14 views

How to design an algorithm for k means-like problem?

I have some observation about a random variable x and I want to estimate the parameters of its probability distribution function. For example: data = {1, 2, 3, 4, 5} and choose normal distribution as ...
1
vote
0answers
36 views

The silhouette coefficient does not increase monotonically

Recently, I have done some clustering with K-means and I use the Silhouette coefficient to estimate the right number of clusters (K). However, my Silhouette coefficient does not increase monotonously ...
0
votes
0answers
20 views

How to initialize k-means

I am working on image processing. I have to apply k-means upon them. But I am confused with the initialization of k-means that either I should use just first frame or all the frames to initialize it. ...
0
votes
1answer
35 views

KNN and K-means, very different but possible equivalency?

Why does the k-nearest neighbor algorithm and k-means clustering algorithm with $k=1$ act the same?

1
2 3 4 5
19