Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
20 views

k means clustering when k = n

I want to find the minimum value of the objective function if we set K equal to the number of samples. I know the objective function is $J=\Sigma_{n=1}^{N}\Sigma_{k=1}^{K}r_{nk}||x_n-\mu_k||^2$ And ...
0
votes
0answers
28 views

Implementation of Bhattacharyya distance for filtering images that are far off from their cluster

I need assistance with the python implementation of Bhattacharyya-distance for the below use case: Here, the polygons P1, P2..Pn refer to the different images where each pixel is represented by 'n' ...
3
votes
3answers
56 views

k-means classifies one data point as a group

I have 1000 sets of one dimensional data (360 each in length), and I want k means to classify what is a small/medium/large value (n_clusters=3) for each set of data, but I'm getting a lot of instances ...
0
votes
1answer
25 views

Clustering of Weekday Weekend Time Series Data

I have a dataset of the number of steps people take throughout a day over a period of months. I aggregated them so that each person will have an average weekday and weekend time series of steps. An ...
-1
votes
0answers
10 views

Plotting the cluster centroids from MinibatchKMeans

I have used the MinibatchKMeans method to plot the points and cluster centers. My problem is, I need to label the cluster centroids with the corresponding cluster (0, 1, 2 etc..). Are the centroids ...
0
votes
0answers
13 views

Creating better features for clustering

I am trying clustering for the first time trying to separate my user into three categories (or the categories I though that they will should fall in). First of all I have two tables that describe ...
1
vote
0answers
67 views

“Memory Error” - Kmeans in python using pandas DataFrame

I am trying to predict on my "dataset_to_predict" having size of (297000 x 5120). While Memory usage is under 50%. No Specific Error message. I'm trying to find # of k using elbow method - Got ...
1
vote
0answers
11 views

How to find anomalies/outliers in Panel Data?

I have panel data based on 900000 different entities with 384 time steps and the data is not normally distributed. I am looking for outliers/anomalies, this is unsupervised as I have no examples of ...
0
votes
1answer
50 views

K-means clustering for one class classification

I want to know if I can use the k-means clustering algorithm for a one class classification (as in the case of one class SVM), which means I have data for 2 classes, and I labelled only the one class ...
0
votes
1answer
29 views

Preparing dataframe to carry k-means clustering [closed]

Im trying to apply 3 different algorithms of clustering on my dataset. to check which one fits the best. I'm confused how should I convert my dataframe -k-means -DBSCAN -hierarchical clustering ...
0
votes
0answers
15 views

Is the mean shift algorithm adapted to my problem?

I'm currently building a model that can detect abnormalities in a timeserie. First, we predict the next steps and then we compare the prediction with what we measure in real time. We want to see if ...
1
vote
1answer
54 views

what could this mean if your “elbow curve” looks like this?

This is from running kmeans clustering with k on the x-axis (ranging from 2 to 10) and the silhouette distance on the y-axis. Clearly there's peaks at k=3, k=4 and it seems to decline from there. It ...
0
votes
0answers
8 views

How to analyze similarity of static K-Means Nodes?

I have performed K-Means(40) clustering on customer product purchases. I am pairing this data with Association Analysis (sometimes called market basket analysis) results to motivate cross-selling ...
0
votes
1answer
10 views

Will the features in the image (edge, color, etc.. ) impacts on the performance of the spherical k-means?

I am very new in Machine learning, I recently implemented the spherical k-means, but finally I found a interesting point from the result. I used four datasets, they are minst, cifar-10, fashion-minst, ...
2
votes
1answer
48 views

How to measure the similarity between two images?

I have two group images for cat and dog. And each group contain 2000 images for cat and dog respectively. My goal is try to cluster the images by using k-means. Assume image1 is ...
0
votes
1answer
51 views

Kmeans clustering with multiple columns containing strings

I have the following dataset: https://www.kaggle.com/carolzhangdc/imdb-5000-movie-dataset What I want to find is clusters based on imdb score per genre per country. I have created a pandas data frame ...
1
vote
1answer
25 views
2
votes
0answers
75 views

Overfitting in K-means

How do you test your results for overfitting in a k-means run? Some people have said use a training set. I have about 1500 records and about 20 fields.
2
votes
0answers
41 views

Randomstate and kmeans issues

I try to cluster a dataframe of 227 rows in 5 clusters using kmeans algorithm. Each time I run my code I got different labels and different clusters which make my analysis afterwards a bit tricky. ...
2
votes
1answer
26 views

Difference between cluster centers and means

The following is the output of the cluster centers I got from a cluster model (kmeans - 6 clusters) 3.371069, 3.920354, 3.629747, 3.700000, 3.988506, 3.740385 However, after segmenting the data ...
0
votes
2answers
43 views

k modes: optimal k

I have categorical data and I'm trying to implement k-modes using the GitHub package available here. I am trying to create clusters in my (large) dataset of say, 5-7 records, each of most similar ...
1
vote
1answer
36 views

What does Make Density Based Clusterer in Weka do?

In Weka, there is a clustering algorithm with the name as Make Density Based Clusterer. When going through its properties, it takes a clusterer as base clusterer(I took it as K-means with k=3). It ...
0
votes
1answer
42 views

How to calculate mean and standard deviation of all features in a class identified by k-nearest neighbors?

I have classified my data into several neighborhoods using k nearest neighbors. I need to efficiently calculate the mean and standard deviation for all features of data points belonging to a ...
0
votes
1answer
57 views

K-modes implementation in pyspark

I'm looking for an implementation of k-modes in pyspark. I found this and this as implementations. First, I tried implementing k-modes using the first link and faced issues. So I went ahead and tried ...
1
vote
0answers
53 views

Best classification technique for following kind of data set

I have a large table where each record or row represents a single salesperson, and there are 50 columns or dimensions where each column represents one of 50 products potentially sold by any given ...
0
votes
1answer
22 views

Use output of K-Mean for Logistics regression

I've created a binary classifier using K Mean, which predicts fraud and legitimate accounts, 0 and 1. This uses two features, let's say, A and B. Now, I want to use other features like C and D, to ...
0
votes
1answer
19 views

Scikit learn kmeans with custom definition of inertia?

I've coded a small clustering algorithm for time signals using kmeans, which works ok (gives acceptable results). However, kmeans uses the sum of squared differences. I would like to be able to input ...
0
votes
1answer
22 views

where does kmeans store its trained model parameters in scikit learn?

Like in linear regression, there is model.intercept_ and model.coef_ but in kmeans i found ...
0
votes
1answer
47 views

Categorical data into numeric in excel

I have a large dataset and I would like to convert these categorical data into numeric in binary form to perform k means clustering in R. However, I get an error in value. This is the formula that I ...
0
votes
4answers
48 views

After running K-means on 12 features, I get an array containing clusters for each row. What is the next step after this?

So I used the elbow method to identify the optimal number of clusters, i.e. 4 in this case. After running K-means on dataset with 12 features, I get an array with the cluster number each row belongs ...
0
votes
2answers
87 views

KMeans vs. DBSCAN

I am trying to understand some basic clustering techniques. What is the main difference between KMeans and DBSCAN? Can we use both techniques for the same problem?
1
vote
1answer
91 views

Kmean clustering on text data

I have a large raw dataset on crime and I want to cluster the data using k-mean, However, I get this Error when I enter this code ...
1
vote
1answer
47 views

K-Means visualisation problem 8 numerical feutres [closed]

Hello im looking for exemple with python for K-Means clustering when i have data set with more than 6 feutres. thanks
1
vote
2answers
163 views

K-Means clustering - What to do if a cluster has 0 elements?

I'm writing code for k-means clustering. I have around 100000 vectors of size 128x1 (SIFT descriptors). I'm trying different initialization methods such as Forgy and Random Partition. What if suppose, ...
1
vote
1answer
98 views

Should unique vectors (SIFT descriptors) be used in K-Means Clustering?

I'm doing image classification by extracting SIFT features, clustering them and then finding BOVW histogram and classifying. I have around 180 training images from which I'm extracting SIFT ...
1
vote
1answer
91 views

Fuzzy Clustering for Categorical Data

I have a dataset in which each feature is either 0 or 1 (like BBOW). I want to cluster the data such that one point can belong to more than one cluster(soft assignment). I searched about this and I ...
0
votes
3answers
131 views

Kmeans large dataset

we are currently performing a K-MEANS under scikit-learn on a data set containing 236027 observations with 6 variables in double format (64 bits). According to our calculations, the complexity of the ...
0
votes
1answer
71 views

k-mean without label [closed]

i m try to apply k-means with Python 3 to my dataset (Amazon review) for classify similar user (from review). I just have a TF and TF-IDF matrix (and i have a row(user) and columns(words) value in ...
1
vote
1answer
158 views

How to plot data points and not centroids using sklearn k-means?

I have issues finding a way to plot data points colored by cluster with k-means. I have a very long list of strings.I managed to plot the centroids but not the data points; ...
0
votes
1answer
43 views

Kmeans cluster validation when I have labeled test data

I'm trying to implement the unsupervised k-means algorithm for sentiment analysis of imdb movie dataset created by stanford. The steps that I followed is : 1) Load the comments 2) Apply tokenization ...
2
votes
2answers
68 views

Clustering 1-d array with constraints?

I have following kind of 1-d array data to cluster with a few constraints: The array has length from 50 to 300, floating, some of them close to 0 and some far away. Goal: divide the array into n ...
0
votes
1answer
49 views

How can i use Hellinger Distance on array of different length?

I have to use Hellinger distance to compare arrays that are not of the same length. Is there a way to do it correctly? Put zero in the missing fields of the shorter array doesn't sound that good to me ...
1
vote
1answer
75 views

RGB Image Segmentation using Clustering

I want to apply some segmentation on a dataset for preprocessing purposes. I have tried the "otsu thresholding" approach in order to segment the image. It's a good method, however, I think a ...
-1
votes
1answer
43 views

Clustering Customers on transactional behavior

Objective: Segment the accounts on their transactional behavior and find the accounts which are more likely to subscribe for loans. Dataset: 1) Account_Number 2-91) Transaction amount ...
1
vote
0answers
14 views

How to preprocessing data of a game [closed]

I have a table of users' scores like this: ...
0
votes
1answer
1k views

Accuracy for Kmeans clustering

I am looking for accuracy python code for kmeans clustering with no labels. Is there anyone who knows about it? it is ok that is not built-in function. Manually made is also ok
1
vote
3answers
41 views

What best/correct algorithm/procedure to cluster a dataset with a lot 0's?

I'm new to statistics so sorry any major lack of knowledge in the topic, just doing a project for graduation. I'm trying to cluster a Health dataset containing Diseases(3456) and Symptoms(25) ...
0
votes
1answer
31 views

confusing regarding to kmeans clulstering for data correlation

I am trying to think through my process before doing any real coding. However, got really confused easily. Say I have 100 instruments and I know their price movements every day for a year. So I can ...
1
vote
1answer
30 views

Theoretical work on validity of restricting movement of Centroid of K-Mean

I recently received a manuscript for review in which author used ~1000 "fake" data points, so that the final centroid of K-mean stays within the required range. Neither me nor the author seems to have ...
1
vote
2answers
59 views

Differences between applying KMeans over PCA and applying PCA over KMeans

Short question: As stated in the title, I'm interested in the differences between applying KMeans over PCA-ed vectors and applying PCA over KMean-ed vectors. Long question: Let's suppose we have a ...