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
0answers
33 views

Best practices for avoiding spurious artifacts in image cluster detection / color quantization

I want to know whether there are some common best practices for unsupervised detection of clusters / colors in images, in order to avoid spurious artifacts. To understand what I mean by 'spurious', ...
1
vote
4answers
1k views

How to handle categorical features in K-means?

I am working on clustering algorithms. I am working with titanic dataset. It contains 6 categorical features. I used k-means algorithm on this dataset. I am using label encoding for categorical ...
0
votes
1answer
616 views

Multidimensional K-Means wiith sklearn, centroids problem when plotting

I am working with a dataset (X) to predict 12 clusters with K-Means using python SKLEARN library: ...
1
vote
1answer
75 views

K-means and LDA for text classification

I hope to explain in a clear way what I would like to do. I have more than 50000 tweets and I would like to add some labels on topics. So I have used LDA for doing this. I have also used k-means to ...
0
votes
2answers
188 views

k-means and LDA for text classification: how to test accuracy?

I have many tweets that I would like classify based on their similarity. Unfortunately I am not quite familiar with text-classification and nlp, so I had to read a lot of documents before having an ...
1
vote
1answer
1k views

Choosing attributes for k-means clustering

The k-means clustering tries to minimize the within-cluster scatter and maximizing the distances between clusters. It does so on all attributes. I am learning about this method on several datasets. To ...
-1
votes
1answer
38 views

How to explain the results from this kmeans?

I got the following results by using k-means algorithm. There are $10$ elements in Cluster $0$ and $3$ elements in Cluster $1$. Do you think it makes sense and it might be an acceptable result? How ...
0
votes
1answer
56 views

Clustering with k-means for text classification based on similarity

I have a column that contains all texts that I would like to cluster in order to find some patterns/similarity among each other. ...
2
votes
2answers
484 views

Clustering mixed data types - numeric, categorical, arrays, and text

I have a dataset with 4 types of data columns: ...
2
votes
1answer
354 views

How to get the probability/closeness of a sample belonging to a specific cluster?

I'm new to this so please let me know if my logic of comparing cosine similarity and k-means is incorrect I got a set of ...
0
votes
4answers
160 views

Clusters: how to improve results for text classification

I am trying to classify texts using kmeans, TfidfVectorizer, PCA. However, it seems that many texts are not correctly classified as you can see: I have texts in cluster2 that should be in Cluster 0 or ...
0
votes
1answer
59 views

kMean clustering for recommendation

I have a file with 50000 rows from a library platform. Each individual row saves a user, and shows the order in which the user, has selected. The books could be from various categories (e.g. roman, ...
0
votes
0answers
32 views

Correct way to use k-means cluster- python-scikit-learn

I am working with Python, pandas and scikit-learn. I have a dataset where I have the number of sales per shop. I have the date and the hour of this sales and I want to forecast the sales for the next ...
1
vote
2answers
321 views

Will one hot encoding / unbalanced columns cause bias to Clustering Analysis?

I'm wondering if having too many columns about one certain feature is gonna cause bias to the clustering analysis. For example, if my dataset has columns = ['incoming calls', 'outgoing calls', '...
0
votes
1answer
502 views

Should dimensionality reduction be done before k-means clustering if there are many features?

My data contains over 200 features and over 500 observations. I want to place the observations into a number of clusters based on the features that make them different. There are numerous ideas I ...
0
votes
2answers
998 views

Compute Accuracy of k-means [duplicate]

Could you please provide me an example of how I can compute the accuracy for a kmeans clustering? I split my dataset into train and test sets and computed the predicted clusters for the train set. ...
0
votes
1answer
186 views

Plotting clustered sentences in Python

I have the following three sentences, extracted from a dataframe. I would like to check the similarity and create clusters based on their level of similarity. ...
1
vote
1answer
555 views

How do I perform K-Means clustering of the Olivetti Dataset

This Question pertains to Matrix Factorization and the full question is given below. Provide for k-means clustering of the Olivetti dataset the following visualizations: A scatter plot of the r = 2-...
2
votes
0answers
354 views

K-Means Clustering Profile Plot & Data Normalization

I am new to k-means clustering and I am working on a project on cryptoanalysis. I have a few questions and I hope to get some help here. I have four variables and my variables data values can range ...
1
vote
1answer
556 views

When to use k-medoids over k-means and vice versa?

I had someone ask me about k-medoids at work and don't know about the performance of this algorithm over other clustering algorithms (namely k-means as it is most similar to it). In this case, it was ...
1
vote
1answer
109 views

How to improve results for clustering of words

I have a list of words (names actually) on which I would like to apply some entity resolution. My first guess was to create clusters of similar names so I could extract a representative entity from ...
1
vote
0answers
37 views

Can someone provide me the code of the MiLoF(Memory Efficient Local Outlier Factor) algorithm?

I have to code the MiLoF algorithm for detecting outliers in an unsupervised manner using non-stationary data. I am attaching the paper which explains the algorithm here. However, there are many ...
1
vote
1answer
119 views

Clustering after PCA: Use the standardized data, or take into account the variation explained at each PC?

I am interested in clustering daily gridded data. Because of the many dimensions (gridpoints), I first perform PCA to reduce the dimensionality and keep the n-first PCs that account for at least 85% ...
1
vote
0answers
153 views

End to end k-means clustering - python

i'd like to share with you my path in a clustering exercise (via K-means using python), in order to understand if i made some errors or if there is something more that can i do. General Overview My ...
1
vote
1answer
35 views

How do I evaluate a K-Means unsupervised anomaly detection approach?

how do I evaluate K-means clustering anomaly detection method as there is no labelled data of anomaly class. To find the cluster (K), I have used the silhouette score from Scikit learn library. Scikit ...
2
votes
1answer
68 views

Clustering with Only Categorical Features

I am trying to do clustering with a bunch (24) of categorical features. I have done some research and found a lot of people recommending something such as K-Modes. I tried running K-Modes on my data ...
2
votes
2answers
249 views

Is confusion matrix possible in one column

I am performing anomaly detection using K-Means. I am working with only one column, plotting those values and then within this column I am adding some anomalies. My question is if it is possible to ...
0
votes
1answer
108 views

Confusion Matrix and AUC in univariate Anomaly Detection

In the code I upon a csv file which only has one column. The data in there in not that important just normal numbers. ...
2
votes
1answer
3k views

How to use Cosine Distance matrix for Clustering algorithms like mean-shift, DBSCAN, and optics?

I am trying to compare different clustering algorithms for my text data. I first calculated the tf-idf matrix and used it for the cosine distance matrix (cosine similarity). Then I used this distance ...
2
votes
3answers
238 views

K-Means anomaly detection not clustering anomalies

K-means anomaly detection scatter plot The following code, takes a single column from a dataset and then adds 50 anomalies to the dataset that is quite bigger than the maximum values of the dataset. ...
2
votes
1answer
334 views

How to test/train a model for realtime data with new data points and classes in a ML pipeline

First, For a text classification problem, if I have trained the model on 2 classes and it gives good accuracy. Now, when I use the model in real-time, there is a completely new class from a totally ...
3
votes
1answer
202 views

PCA and k-means for categorical variables?

I have a clustering task at hand. The data that I have contains only categorical variables. So, k-modes seemed like the best option. But I am not sure what are the data pre processing steps required ...
0
votes
1answer
93 views

How to speedup K-Means used in 'for loop'

I'm trying to solve an interesting problem. One solution which seems to work well, involves using K-Means in a 'for loop'. The dataset per loop is independent and fairly small (Minibatch not required)....
2
votes
1answer
557 views
3
votes
1answer
137 views

Why is hierarchical clustering quadratic and k-means linear?

According to the internet, k-means clustering is linear in the number of data objects i.e. O(n), where n is the number of data objects. The time complexity of most of the hierarchical clustering ...
2
votes
1answer
420 views

Outlier Detection using K-Means using one column

I have done and read a csv file and then plotted the values of a single column using K-means ...
0
votes
3answers
204 views

K-Means Clustering too crowded

I have written a simple python code that opens a csv files and then clusters the values of one column. There around 10k rows This is my code ...
1
vote
1answer
125 views

Elbow method on hundreds columns and rows

So I have these vectors called matrix_ after I applied TF-IDF (term frequency-inverse document frequency), and I also converted it to dataframe ...
-2
votes
2answers
973 views

Clustering data set with multiple dimensions

I have a data set which is similar to the following: It is recipe data along with the composition of the recipe (in %) I have 91 recipes and 40 ingredients in total. I want to be able to cluster ...
0
votes
2answers
3k views

K-Means Clustering for data points with multiple attributes

I'm very new to K-Means clustering. Every example that I have seen has a two-dimensional data set. I am working to classify recipes of varying ingredient composition into families. Each recipe is ...
-1
votes
1answer
79 views

kmean clustering

I am having a problem in Matlab. I would like to use kmeans clustering and then get the value and index of the centroid. For example, if there is an $5*5$ array, we do kmeans clustering where k=2 and ...
2
votes
0answers
262 views

Will flattening multivariate time series data before clustering make the results meaningless?

I have a large number of financial time series that I wish to do cluster analysis on. Each time series has the same length and spans multiple years of daily data (returns, volatility, etc.). As part ...
5
votes
1answer
196 views

How do I interpret my result of clustering?

I am working on a clustering problem. I have 11 features. My complete data frame has 70-80% zeros. The data had outliers that I capped at 0.5 and 0.95 percentile. However, I tried k-means (python) on ...
3
votes
1answer
382 views

What value can I gain by doing exploratory data analysis on features (and thus data) before doing clustering?

This might not be a very good question, but I would still ask if it's beneficial to do EDA before running a clustering algorithm? I understand that EDA helps us generate good and helpful insights ...
2
votes
2answers
698 views

How to deal with with rows with zero in every feature while clustering?

I am working on a clustering problem which has 13000 observations and 15 features. Around 3000 observations in the dataset has zero in every features ( i.e all values zero in 3000 rows). I am trying ...
3
votes
2answers
1k views

Is k-means with Mahalanobis a valid option for clustering?

I want more info into if k-means with Mahalanobis distance is a mathematically/methodologically correct option for datasets with different variance clusters. The steps are: Create aggregate datasets (...
2
votes
1answer
453 views

Using TSNE to Visualize Clusters in Python

I'm using TSNE to visualize my clusters but the output seems a bit strange. There are supposed to be 3 clusters but instead, there are 4 lines. Is there something wrong with how I'm visualizing them ...
12
votes
1answer
249 views

What are practical differences between kernel k-means and spectral clustering?

I've been lately wondering about kernel k-means and spectral clustering algorithms and their differences. I know that spectral clustering is a more broad term and different settings can affect the ...
2
votes
1answer
38 views

How to retrain a K-Modes model based on daily data?

I have read that retraining a model depends highly on what you are trying to achieve. I am conscious that maybe I need to retrain my model daily and after a certain time I have to train the model ...
1
vote
1answer
56 views

Google Earth Pro Satellite image segmentation using clustering

I have downloaded a satellite image from Google Earth Pro software corresponding to a particular date for a selected area around a place. I want to specifically segment the road lanes from the image ...

1 2
3
4 5
9