Questions tagged [k-means]

k-means is a family of cluster analysis methods in which you specify the number of clusters you expect. This is as opposed to hierarchical cluster analysis methods.

Filter by
Sorted by
Tagged with
1 vote
1 answer
42 views

Beginner basic clustering model and one-hot encoding?

I have a dataframe of natural disaster incidents in Afghanistan from 2016 - 2023. Column names: REGION (Northern, Eastern etc) PROV_CODE (province) PROV_NAME DIST_CODE (district) DIST_NAME INC_DATE (...
Mas's user avatar
  • 13
0 votes
0 answers
8 views

Using nearest neighbor in RANSAC

I found many resources online talking about nearest neighbor concept in RANSAC. For example, figure 2 of this paper, this article and this repo talk about nearest neighbor in the context of RANSAC. ...
RajS's user avatar
  • 103
0 votes
0 answers
54 views

Identifying recurring transaction clusters (subscriptions) at a user level

I need some help converting this issue into a machine learning problem. Goal: Grouping credit charges into clusters of recurring transactions per user Input data: List of credit card charges with <...
Fintech Pikachu's user avatar
0 votes
0 answers
31 views

The optimal way to stratify a numerical target variable into a categorical one for a machine learning algorithm

I have tabular data, the predictive variables are numerical and categorical and the target variable is a numerical one. Using the proper techniques I can make predictive models with R^2=0.95. Now let'...
ADayWithoutRain's user avatar
0 votes
1 answer
60 views

Is this considered a good visualization of clustered data?

I have used sckit-learn to cluster data using K-means (3 clusters). I have an issue with considering the plot as "readable" since clusters are overlapping (even when encircling them) Any ...
SSSOF's user avatar
  • 17
0 votes
0 answers
18 views

Building an application to group/label browser tabs

I'm trying to develop an application where users can click a button and all of the open tabs in their browser will be placed into tab groupings based on similarity of the tab. Microsoft Edge has a ...
Ben's user avatar
  • 1
0 votes
0 answers
40 views

Low silhouette score yet better clustering result

I applied k-means and k-medoids clustering techniques on iris dataset, in particular I clustered with respect to sepal length and sepal width features across 4 classes. With k=3 using k-means I ...
Harshavardhana Srinivasan's user avatar
0 votes
0 answers
12 views

Does scikit learns implementation of silhouette score support parallelization and will benefit from multiple CPUs?

I wish to use the silhuette score to get the optimum number of clusters. I know kmeans implementation in scikit learn supports parallelization. But I am unsure whether the same is true for silhouette ...
Ali Raheel's user avatar
0 votes
0 answers
10 views

Is there a way to artificially manipulate a dataset in order to replace it for one that gives good predictions?

I'm trying to artificially create a dataset for pure educative reasons but I want it to be based in one particular dataset, the problem is that this original dataset don't make good predictions even ...
CinfaCinfa's user avatar
0 votes
3 answers
159 views

Clusterise a group of answers taking the question as relevant information

I am solving a problem where I group answers to a given question into clusters using k-means algorithm. The steps I follow are: For every answer I get the corresponding vector. Reduce the vector ...
jesantana's user avatar
0 votes
1 answer
34 views

Plot Clustered Data by kmeans with colors for clusters and shapes for external labels

I wrote some Python code that uses the output from a principal component analysis to perform k-means on. The output to my script below is Cluster 1: Data Points: [[ 1.87192346 -1.12568277] [ 1....
Squirtle's user avatar
  • 103
1 vote
1 answer
131 views

Why is accuracy score suddenly becoming 1 on using XGBoost?

I am developing a music classification system based on a kaggle dataset: https://www.kaggle.com/datasets/vatsalmavani/spotify-dataset I tried using K means classifier to classify the songs into 4 ...
fat_gladiator17's user avatar
0 votes
1 answer
11 views

Method to Compare the Fit of of k-Medoids and GMM to my Dataset

I'm looking for a method(s) to compare the fit of k-Medoids and a GMM. Currently, I'm looking at the distance between the max-min means of the GMM clusters and comparing that to the max-min medoid ...
Andrew Feenan's user avatar
0 votes
0 answers
27 views

PySpark KMeans model has negative training cost

I am fitting a KMeans model for clustering using cosine distance measure. After model fitting, when I check the training cost of the model as below, ...
hypothesisusable's user avatar
0 votes
0 answers
46 views

Equivalence between K-Means objective functions proof

I am working on a project involving the K-Means clustering algorithm, and I am trying to prove the equivalence between different formulations of the objective function. Specifically, I want to show ...
Oren Ben Eliyahu's user avatar
0 votes
0 answers
9 views

Understanding differentiation via chain rule in M-Step K-Means clustering

The following slide is from Erik Bekkers's excellent courselesson 9.2 How is it that we can re-write the following? $||x_n-\mu_k||^2$ as $(X_n-\mu_k)^T(X_n-\mu_K)$ Also I understand how we get the -2 ...
Kirsten's user avatar
  • 57
0 votes
0 answers
14 views

Common properties of a clusture

After doing kmeans clustering how to find out the common properties of each cluster. Shall we go for feature importance of each cluster?
Banalata Das's user avatar
0 votes
0 answers
14 views

Numerical instabilety with kmeans

If i understand the math right a kmeans iteration should always improve cosine similarity. So if the data is z-normalized it should always improve corelation Well it seemed to be the case for a small ...
Nevo Krien's user avatar
1 vote
1 answer
403 views

best algorithms for clustering customers, customer segmentation

I have a dataset mixture of categorical and numerical variable, I was wonder what are the best algorithms to cluster customers? how to find the underlying patterns that segments a customer??
F.Hazratian's user avatar
0 votes
1 answer
40 views

Efficient ways of clustering for big data

I have a task which is customer segmentation with 120k users and a record of their purchases which is +3 million records of data, the approach I want to use is to use clustering algorithms like kmeans ...
F.Hazratian's user avatar
0 votes
0 answers
14 views

K-means and cluster formation

I'm using K-means method on data sets where often times the data points form horizontal formations as per screenshot. When that is the case, I would like to change the model or adjust it so that ...
mattK's user avatar
  • 1
0 votes
1 answer
43 views

Maximum categories for categorical variables in K-Means clustering

I am trying to perform K-means clustering on a dataset, and one of my categorical features has 96 possible options. Would this be too many features for one variable to have? The alternative would be ...
imad97's user avatar
  • 101
1 vote
1 answer
97 views

Determining threshold for KMeans anomaly detection

I'm trying to use KMeans for anomaly detection, and I know that a threshold is needed to determine the anomalies. I've seen many articles talking about how to choose K, but none talks about how to ...
Rayne's user avatar
  • 131
1 vote
0 answers
41 views

Modified kmeans algorithm returns the wrong answer

I am trying to create a kmeans algorithm that is based on the Earth Movers Distance instead of the Euclidean distance. However, when I run it, it just returns the same value for all data points. The ...
Ozzy08's user avatar
  • 11
0 votes
1 answer
39 views

Best way to compare classification output between different locations

I ran a neural network for 20+ different locations across the United States. At each location I have a list of their predictions in an array. This looks something like this... ...
Jack Cahill's user avatar
0 votes
0 answers
14 views

Finding centroids with less difference but high variability

I have a data set including lat , lon and id's for some places. Also I have another table which has features for each id's. I wanted to find cluster centroids for those places. Using lat and lot ...
datatech's user avatar
0 votes
1 answer
82 views

KMeans is not predicting the correct cluster

k-means clustering is done and created 5 optimal number of clusters. (Clustering is done unevenly). While using them in my model, the model is not choosing the exact cluster which has the exact data. ...
sai_0033's user avatar
0 votes
1 answer
41 views

What can be the reasons for 95% of samples belong to one cluster when there is 5 clusters?

'''I used the k-means algorithm to clustering set of documents which are textual data only. The document has 2lack records. Surprisingly the result for the clustering is 90% of records is storing in 1 ...
sai_0033's user avatar
0 votes
1 answer
170 views

how to evaluate the combination of tfidf and kmeans

For my nlp problem I'm using a combination of TFIDF and KMeans from the sklearn package. The tfidf gets the vectors and then I use Kmeans to cluster the texts based on the vectors. I have a few ...
james pow's user avatar
  • 167
0 votes
0 answers
10 views

Understanding model behavior

I am checking the accuracy of a new model (Kmeans with Iterative RF) over SICE (Single Imputation Of Chained Equation) for missing data imputation. For 5-10% SICE is performing well thereafter our ...
Vishnu's user avatar
  • 1
1 vote
0 answers
88 views

Jenks goodness of variance fit - Interpretation

I am working on clustering/grouping 1D data. I am trying to find bins of multiple variables seperately. So, I tried the jenks natural breaks algorithm. Based on the ...
The Great's user avatar
  • 2,555
0 votes
1 answer
634 views

Perform k-means clustering over multiple columns and get the cluster center values?

I read here how to show the number of clusters over $n$ columns. I would like to know how to get in a table, the values of the clusters centers. Could someone help me with this?
boxertrain's user avatar
2 votes
3 answers
65 views

Differentiate between two set of points

Consider two sets of points (in the pictures below), whose "center of gravity" is same. What measure can differentiate between the two sets? e.g. Image 1 ...
s510's user avatar
  • 121
0 votes
1 answer
678 views

Clustering latitude, longitude along with numeric and categorical data

I am working on clustering the customer base of a business-to-business company. I have data on customers that consists of both numerical (e.g. # of purchases made, avg. spend per purchase) and ...
Ultralite's user avatar
  • 101
0 votes
1 answer
41 views

Do 0-columns affect the results of time series clustering when using k-means and Ward's method?

I would like to cluster multidimensional time series using k-means and Ward's method. My base dataset has 4 columns (features) and each of them is a time series of 288 values. So one "datapoint&...
PeterBe's user avatar
  • 81
1 vote
2 answers
69 views

Automate Clustering predictions and RFM metrics

We did a POC for customer segmentation and followed the below approach a) extract data from source system (SAP business objects) b) Use python jupyter notebook to manipulate, merge and group data (...
The Great's user avatar
  • 2,555
1 vote
1 answer
121 views

Should K-modes or K-means be used?

I have data obtained from a survey and I would like to make a grouping of the individuals who responded to the survey according to the questions they answered. The range of answers is: strongly agree, ...
MSmith's user avatar
  • 11
2 votes
1 answer
98 views

Using k-means to create labels for supervised learning

I want to know if the following is a valid approach to create labels, if I have measurements under some conditions, and the conditions are similar but never exactly the same. This doesn't correspond ...
Seb001's user avatar
  • 23
2 votes
1 answer
30 views

I need help with which features to use for clustering

I am using this dataset: https://www.kaggle.com/datasets/sobhanmoosavi/us-accidents and so far I have successfully cleaned the dataset as well as reduced the size of the features and records. I have ...
Giannhs Meh's user avatar
1 vote
1 answer
42 views

Interpreting cluster variables - raw vs scaled

I already referred these posts here and here. I also posted here but since there is no response, am posting here. Currently, I am working on customer segmentation using their purchase data. So, my ...
The Great's user avatar
  • 2,555
0 votes
1 answer
47 views

How to improve the result? Should I remove the columns?

I am using this dataset, the target column is the last one which is 'DEATH_EVENT', I have separated this last one. I am using KMeans to calculate the number of hits and misses. The result is quite bad,...
Agat0's user avatar
  • 1
1 vote
3 answers
344 views

How To Develop Cluster Models Where the Clusters Occur Along Subsets of Dimensions in Multidimensional Data?

I have been exploring clustering algorithms (K-Means, K-Medoids, Ward Agglomerative, Gaussian Mixture Modeling, BIRCH, DBSCAN, OPTICS, Common Nearest-Neighbour Clustering) with multidimensional data. ...
from keras import michael's user avatar
0 votes
1 answer
38 views

Optimal clusters for K-means not clear - any ideas?

I have a toy dataset of 10,000 strings of people's names, addresses and birthdays. As a quirk of the data collection process it is highly likely there are duplicate people caused by typos and I am ...
Sandy Lee's user avatar
  • 237
3 votes
1 answer
2k views

Kmeans clustering in python - Giving original labels to predicted clusters

I have a dataset with 7 labels in the target variable. X = data.drop('target', axis=1) Y = data['target'] Y.unique() array(['Normal_Weight', 'Overweight_Level_I', '...
Usama2298's user avatar
1 vote
1 answer
56 views

Confusion about the value of within-cluster SSE

I have a dataset of shape (29088, 11). When I apply the Kmeans where K=2 I get the following plot: I am surprised that the value of Sum Squared Error (SSE) for C0 (...
Dave's user avatar
  • 238
1 vote
0 answers
386 views

How to calculate the purity of K-Means clustering

I am trying to work out how to I have a labelled dataset that I want to cluster with scikit-learn k-means. The label's column name is "Classes" I don't want the labels to interfere with the ...
Bryon's user avatar
  • 111
1 vote
0 answers
54 views

Interpretation of the results of the Elbow and K-means

I have the following dataset (after scaling) which contains 5 features: : My objective is to cluster this data using an unsupervised ML model. After using the Elbow method, I get 2 clusters as below: ...
Abdessamad139's user avatar
1 vote
0 answers
563 views

K-Means time series clustering with multiple time series for each data point

I have been trying to cluster my data through K-Means. However, for each datapoint that I have, there is 4 different time series (In, Out for Weekend/Wekeday). I have been looking to do multivariate ...
vernal123's user avatar
1 vote
1 answer
190 views

What are the benefits of using spectral k-means over simple k-means?

I have understood why k-means can get stuck in local minima. Now, I am curious to know how the spectral k-means helps to avoid this local minima problem. According to this paper A tutorial on ...
Amartya's user avatar
  • 133
1 vote
0 answers
42 views

Clustering days based on features

I am trying to perform a inner-clustering of a time-serie constisting of days (i.e, clustering similar days) using a set of features $x_i = [f_1, f_2, ..., f_n], i \in D$ set of days. I can choose ...
King Powa's user avatar
  • 111

1
2 3 4 5
9