Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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
0 votes
1 answer
22 views

Does performing k-NN on the centroids of clusters obtained from k-means make sense mathematically?

While playing around with some text embeddings, I used k-means clustering to get 4 clusters. I also have the labels for these embeddings, and I may simply use k-NN to classify new embeddings. However, ...
Moltres's user avatar
  • 103
0 votes
0 answers
8 views

Model for k means clustering of last mile logsitics data set

I want to utilize Orange for K means clustering for Network Design for Courier Company using K means clustering. Data set includes Longitude & latitude of delivery points, parcel weight, area type ...
asdcxbx's user avatar
0 votes
0 answers
5 views

CNN to estimate a density map of an image, used to predict the object count

I'm trying to count the number of objects (larvae in this case), from a video. The constraint is, I cannot use any ML model, nor can I train my dataset as there are no annotations available. This ...
driver's user avatar
  • 101
0 votes
1 answer
18 views

What is normalized winning frequency in kernel self organizing map(SOM)?

In the k-means based kernel SOM, proposed by MacDonald and Fyfe (2000), the update of the mean is based on a soft learning algorithm mi(t + 1) = mi(t) + Λ[φ(x) − mi(t)] where Λ is the normalized ...
Anshuman Jayaprakash's user avatar
0 votes
0 answers
13 views

What is normalized winning frequency in kernel self organizing map(SOM)?

In the k-means based kernel SOM, proposed by MacDonald and Fyfe (2000), the update of the mean is based on a soft learning algorithm ...
Anshuman Jayaprakash's user avatar
-1 votes
1 answer
38 views

TypeError: unhashable type: 'slice' K-Means; Custom code for K-Means

Problem Statement The goal is to have the K-Means customer code run for clusters and not use scikit-learn libraries. Learning exercise. This K-means has the standard predict, fix, centroids, cluster ...
Data Science Analytics Manager's user avatar
0 votes
1 answer
23 views

K means clustering of image with k=1 vs mean of all pixels

I have relatively uniformly colored images and I extracted colors using k-means. k means 1 showed the best results for my modeling purposes, k means 2 not so much, and with k-means 3 there ceased to ...
phil27's user avatar
  • 1
0 votes
1 answer
36 views

Enhance clustering with evaluation function

My goal is to partition a dataset (X) in distinct clusters. I'm using k-means to be able to pick the center of each cluster assuming all other datapoints behave the ...
acocado's user avatar
1 vote
2 answers
183 views

Kernel Kmeans formula

I'm trying to implement the Kernel Kmeans algorithm but I struggle with the following formula : Let's say I have a case in one dimension with three points : 1, 5, 9. Let's say I want two clusters. ...
app_idea54's user avatar
1 vote
1 answer
95 views

Kernel Kmeans implementation

I'm currently trying to implement the Kernel Kmeans from scratch. At the time I'm writing this post, my implementation is perfectly working on nested circles dataset or even on Iris dataset (see ...
app_idea54's user avatar
0 votes
1 answer
23 views

Why is there a kmeans and kmeans_plusplus function in scikit-learn?

I want to use the kmeans method in the scikit-learn library and I was reading the documentation to see if there was a parameter to use kmeans++. It turns out that this is the default behavior. However,...
Adrian Fletcher's user avatar
0 votes
0 answers
17 views

Upsell and cross sell opportunity via recommender system

I have a million residential customers across the United States who purchase my service. Some buy a single service, some buy multiple services. I want to identify similar customers who are alike in ...
Sean Ryan's user avatar
1 vote
1 answer
67 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
  • 55
0 votes
0 answers
12 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
85 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
37 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
67 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
29 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
62 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
16 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
241 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
71 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
429 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 ...
zero_day's user avatar
0 votes
1 answer
14 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
54 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
2 votes
1 answer
673 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
41 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
1 answer
56 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
131 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
42 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
1 answer
92 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
42 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
224 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
1 vote
0 answers
101 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,565
0 votes
1 answer
827 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
69 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
897 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
43 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
  • 83
1 vote
2 answers
83 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,565
1 vote
1 answer
165 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
104 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
32 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
77 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,565
0 votes
1 answer
50 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
385 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
42 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
  • 247
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
80 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
  • 248

1
2 3 4 5
9