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.
445 questions
0
votes
0
answers
11
views
I want to automate the process of putting the similar name files in a separate folder
I have a list of paths of all the folders in a subfolder , and some path_names have "Chapters"or"Chapter"or"chapter"or even "chaptser" , I want to detect these ...
0
votes
0
answers
21
views
Should I use StandardScaler on a dataset with binary,descreet and continuos data?
I have a dataset consisting of mixed type of features, I already transformed the categorical ones in descrete and binary. Because the dataset is highly dimensional I want to use PCA to reduce it. I ...
0
votes
1
answer
44
views
K-means algorithm for multiple variables
I am a new to ML and current in reading about K-Means algorithm and trying it out with ORANGE tool. After going through several examples on YouTube and various other places, I am slightly confused on ...
0
votes
0
answers
20
views
Spectral clustering with overlapping communities
Is there utility in replacing the Euclidean hard clustering heuristic (e.g., $k$-means) step in spectral clustering with a fuzzy clustering step to detect overlapping clusters? I am assuming this ...
0
votes
0
answers
29
views
Multi-class Classification with Categorical and Time-series Features
I have a problem where I want to classify certain entries into clusters, based on their categorical features (such as Country, Category, as dataframe columns), and also their selling pattern (time ...
1
vote
1
answer
27
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, ...
0
votes
0
answers
14
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 ...
0
votes
0
answers
16
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 ...
0
votes
1
answer
26
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 ...
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
...
-1
votes
1
answer
77
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 ...
0
votes
1
answer
26
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 ...
0
votes
1
answer
40
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 ...
1
vote
2
answers
195
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. ...
1
vote
1
answer
103
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 ...
0
votes
1
answer
73
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,...
0
votes
0
answers
21
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 ...
1
vote
1
answer
134
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 (...
0
votes
0
answers
46
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'...
0
votes
1
answer
117
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 ...
0
votes
3
answers
339
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 ...
0
votes
1
answer
479
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....
1
vote
1
answer
699
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 ...
0
votes
1
answer
22
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 ...
2
votes
1
answer
915
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??
0
votes
1
answer
47
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 ...
0
votes
1
answer
177
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 ...
1
vote
1
answer
171
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 ...
1
vote
0
answers
43
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 ...
1
vote
1
answer
46
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...
...
0
votes
1
answer
119
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. ...
0
votes
1
answer
54
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 ...
0
votes
1
answer
249
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 ...
1
vote
0
answers
127
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 ...
0
votes
1
answer
1k
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?
2
votes
3
answers
76
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 ...
0
votes
1
answer
1k
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 ...
0
votes
1
answer
48
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&...
1
vote
2
answers
95
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 (...
1
vote
1
answer
193
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, ...
2
votes
1
answer
108
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 ...
2
votes
1
answer
33
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 ...
1
vote
1
answer
134
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 ...
0
votes
1
answer
53
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,...
1
vote
3
answers
423
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. ...
0
votes
1
answer
53
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 ...
3
votes
1
answer
3k
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', '...
1
vote
1
answer
95
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 (...
1
vote
0
answers
536
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 ...
1
vote
0
answers
74
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:
...