Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
0 answers
38 views

Kaplan-Meier plots in R [closed]

I have generated the following clusters. Now I want to compare 3 groups in terms of survival. I am wondering how to create 3 groups based on "scores" and draw KM plot. Codes: ...
4 votes
1 answer
3k views

clustering groups but with multiple observations per group

I'd have 10 groups and hundreds of observations per group. In this toy example I only have 3 groups with 20 observations each. I am looking to see if groups are similar so I'm using kmeans to ...
0 votes
2 answers
871 views

R - high dimension data using k means clustering [closed]

The dataset is 1000(observations) x 700(variables), After using pca to do dimension reduction, PC150 explained 85% Variance, so I use this (1000 x 150) data to do k means clustering. This code was ...
3 votes
0 answers
38 views

Is my variable considered okay to use in k-means clustering with Euclidean distance?

I was wondering if I can use regular kmeans() in R with my variable "number of drug prescriptions" which equals a number between 1-25. From what I've read k-means ...
0 votes
1 answer
1k views

K-Means Variable Selection

I have a simple data set, 1200 Rows and 20 variables, 1 is a categorical variable with 8 unique values. 1 variable is a unique reference number. I'm looking into using Kmeans clustering to find the ...
-1 votes
1 answer
94 views

Does this clustering quality metric make sense?

I am trying to stop at best quality metric in my clustering task. (I make spectral clustering using k-means). In short, I calculate intra-cluster pair-wise distances, take their square and sum them ...
0 votes
1 answer
910 views

Clustering phrases using K-Means

I have a data set with some phrases. ...
3 votes
0 answers
127 views

Adding weights to functions not accepting weights

If I had a vector of weights for each observation data(iris) wghts <- abs(rnorm(nrow(iris))) And I had a function that did not accept weights as an argument: ...
2 votes
1 answer
9k views

How to I determine the maximum number of iterations in K-means clustering?

In the documentation of kmeans, the default value of iter.max is 10: kmeans(data, modes, iter.max = 10, weighted = FALSE, fast = TRUE) I don't understand why. And I also wonder how to determine the ...
0 votes
1 answer
82 views

Clustering for medium data [closed]

Which clustering method is good in R for a data with ~32,000 subjectsa and 10 variables, hierarchical or k-means?
3 votes
1 answer
5k views

What are the differences between Lloyd's, MacQueen's and Hartigan's algorithms for K-Means?

There are three distinct algorithms for the K-Means function in R. These are: Lloyd's MacQueen's Hartigan's I believe I understand how Lloyd's works. 1. The cluster centers are chosen. 2. Points are ...
3 votes
1 answer
3k views

How can I order kmeans clusters?

I have a kmeans cluster object and I would like to order the clusters. Not the observations within the clusters, rather the clusters in order of each other. Is there a way of doing this? I found ...
1 vote
1 answer
351 views

Kmeans results, is the cluster vector ordered by 'closeness"?

I ran kmeans in r with k = 20 centers and 7 scaled variables to cluster with on a data frame with n = 100K. Using dplyr group_by I was able to view summary data for each of the 20 clusters: the mean ...
22 votes
3 answers
27k views

Why does gap statistic for k-means suggest one cluster, even though there are obviously two of them?

I am using K-means to cluster my data and was looking for a way to suggest an "optimal" cluster number. Gap statistics seems to be a common way to find a good cluster number. For some reason it ...
1 vote
2 answers
3k views

How to optimize the result of K means

I am analyzing the data of abalone. My goal is to classify the data into three categories(premium, medium premium, and classic). Since it's an unlabeled dataset, so I utilized K means clustering to do ...
0 votes
0 answers
367 views

Weighted K-means for my super market vs K-means

I have a Super Market. I want to find if product A is out of stock which product should i replace with. I am not sure what should i do, someone suggested me K-means for that. If sppose my data looks ...
user avatar
4 votes
2 answers
111 views

Is k-means clustering supposed to behave like this?

First of all, data I'm using can be found here. My code is: ...
1 vote
1 answer
557 views

K-means clustering on a large matrix using kendall's tau as a distance measure

I'm trying to use kmeans clustering on a relatively large matrix (4000x4000) using the amap::Kmeans function but R seems to be freezed even after more than half an hour. I have to restart R after this....
1 vote
2 answers
395 views

Cluster Analysis on a 20,000+ row data set using K-Means 'tot.withinss' not working in R

I have 20,000+ rows of data around 7 columns. I tried to do cluster analysis on it using K-Means where k= 5. When I attempted to plot the clusters, it was not helpful at all, too much data so it all ...
1 vote
0 answers
138 views

Analysis of k-means clustering in r

I have a group of 144 people. I have 3 categorical observations and each of them is described by three variables. After performing a k-means on 3 clusters in r I see that one of the groups, "overt" ...
0 votes
1 answer
1k views

Can I use Clustering with mixed data type in R? [duplicate]

I know there is same question in cross validated. But it is somewhat different. Clustering of mixed type data with R At there Q&A, as using daisy funtion(), we can use categorical data type in ...
8 votes
1 answer
15k views

Outlier detection with data (which has categorical and numeric variables) with R

Scenario I have a project about fraud detection where i need to find outliers by kmeans. I have a dataset about bank credits length of 1000. There are 21 columns (14 categorical, 7 numeric ...
1 vote
1 answer
357 views

R: why different between [k-means] build-in function and Kmeans from amap package

I am doing k-means algorithm on iris data using two functions, the regular "kmeans" and "Kmeans" from amap package. ...
0 votes
1 answer
217 views

K-means : choose Optimum number of clusters based on graph [duplicate]

I've come into a situation where I dont understand How to choose the number of clusters. The WithinSS increases suddenly after 6. How/What do I interpret of this graph ? Background : I've applied PCA ...
13 votes
2 answers
50k views

Interpreting result of k-means clustering in R

I was using the kmeans instruction of R for performing the k-means algorithm on Anderson's iris dataset. I have a question about some parameters that I got. The ...
2 votes
2 answers
1k views

Clustering with numerical variables and one non numerical

I'd like some help with an issue that might seem easy but I'm stuck in my analysis. I'm working with R on a dataframe containing 15 variables: 14 numerical or Integer and 1 factor. I'd like to do ...
5 votes
2 answers
10k views

Optimal number of clusters using K-Prototypes method in R

I am trying to cluster some big data by using the k-prototypes method. I am unable to use K-Means as I have both categorical and numeric data. I have been using the package "clustMixType" and have ...
0 votes
0 answers
712 views

can I use manhattan distance function on hartigan wong kmeans clustering

I would like to perform Hartigan Wong clustering on high dimensional data. As I understand, Manhattan distance works better than the Euclidean distance in higher dimensions. I have been using the K-...
2 votes
0 answers
2k views

Why Elbow algorithm plot shows a straight line instead of curve line?

I want to apply kmeans clustering algorithm on dataset of 12008 samples. This dataset is actually an eigenvector matrix of size (12008 * 12008) generated from given laplacian matrix. In order to ...
16 votes
2 answers
19k views

Is there a function in R that takes the centers of clusters that were found and assigns clusters to a new data set

I have two parts of a multidimensional data set, let's call them train and test. And I want to built a model based on the train ...
3 votes
2 answers
3k views

Is there a clustering algorithm that can take a maximum distance from any mean as a constraint?

I am building an analytical tool that depends on being able to take a bunch of 1 dimensional numbers and group them into categories based on how close each number is to the mean of the group. However, ...
1 vote
1 answer
935 views

k means for segmenting time series [closed]

Now, I am trying to understand how to segment a multivariate time series using k- means. I understand that the basic concept is to use centroids of segments rather than centroids of data points and ...
1 vote
1 answer
193 views

Unsupervised classification - verification of clusters

Not sure if this is best placed here but I will have a go. I am working with clinical data in order to stratify patients using different biomarkers. I have log transformed and MinMax normalised all ...
0 votes
1 answer
927 views

Why did K means clustering do a poor job in R

I am trying to implement K means clustering in R, Here is what my data look like: ...
1 vote
1 answer
49 views

Approach to Problem- K-Means with distribution constraint

I have 4 variables A (continuous), B (continuous), C (categorical-binary), and D (categorical-multinomial) which I need to split into K (known) groups. However, in addition to minimizing the distance ...
2 votes
2 answers
713 views

Mapping k-means cluster centers and origins (measuring k-means accuracy)

Say I generate a dataset $X$: the first $i$ samples follow $x_i\sim N(\mu_1,\Sigma_1^2)$, the next j samples follow $N(\mu_2,\Sigma_2^2)$ and the last $l$ samples from $N(\mu_3,\Sigma_3^2)$. Naturally,...
6 votes
1 answer
11k views

R - How to fix NbClust error with error message: "The TSS matrix is indefinite. There must be too many missing values."

I would like to know how I can use clustering methods in R (in this case, Kmeans) if I have an "unkind" input matrix (I get this error log: The TSS matrix is indefinite. There must be too many ...
2 votes
3 answers
3k views

Clustering into ordered clusters

In a research study I have a list of countries and data about them. GDP Population Oil exports Oil imports Percentage of electricity produced with renewable energies Urbanization Percentage of GDP ...
0 votes
2 answers
653 views

Grouping customers together into like groups based on multiple variables without a categorical variable

I am looking for a little guidance as to the correct approach to this problem. We have a list of IDs and roughly 8 different numerical variables such as quantity and revenue. Each ID is unique to the ...
6 votes
2 answers
5k views

Fuzzy K-means - Cluster Sizes

I'm trying to do fuzzy k-means clustering on a dataset using the cmeans function (R) . The problem Im facing is that the sizes of clusters are not as I would like them to be. This is done by ...
2 votes
1 answer
186 views

After creating a cluster in R, how can I identify which centers are the most important in each cluster? [closed]

I have 30 observations and 60 variables. I conducted a k-means cluster in R with 5 clusters. If I am supposed to choose only 10 variables to show that they have the impact on creating clusters more ...
1 vote
0 answers
149 views

$k$-means clustering

I have two hundred $15 \times 15$ matrices containing correlation values between 15 nodes at 200 different time points. I want to cluster the 200 matrices using $k$-means clustering. Question: Is ...
3 votes
2 answers
13k views

Cross-validation for k-means clustering in R

I have a dataset of two columns (we can call them x and y). I understand that for cross-validation I need to split my data into k partitions, and for that the general consensus is that I use ...
1 vote
0 answers
446 views

Using randomforest to predict clusters made by kmeans, IMDB 5000 Kaggle dataset

I have made 4 clusters of movies based on imdb score, number of votes and gross profit. These are nice interpretable clusters with a BSS/TSS of 65%. Now I would like to use randomforest to predict in ...
4 votes
2 answers
9k views

Cluster analysis with K-means. How to get the cluster representatives?

I am trying to do some multivariate cluster analysis as follows: I have a file in which I have the data and I perform the cluster analysis using k-means: ...
9 votes
1 answer
10k views

Was it as valid to perform k-means on a distance matrix as on data matrix (text mining data)?

(This post is a repost of a question I posted yesterday (now deleted), but I've tried to scale back volume of words and simplify what I'm asking) I'm hoping to get some help interpreting a kmeans ...
4 votes
1 answer
1k views

Within the context of a document term matrix, what exactly are x and y axis in kmeans clustering?

I'm reading up on kmeans and following a blog post to do some text analysis. I watched a helpful video by Andrew Ng fro Coursera which really helped my understanding of what is going on. Here is a ...
1 vote
2 answers
8k views

Cluster Analysis for large data in R

I am trying to perform a clustering analysis for a csv file with 50k+ rows, 10 columns. I tried k-mean, hierarchical and model based clustering methods. Only k-mean works because of the large data set....
5 votes
1 answer
5k views

Why Is Total Sum of Squares Result from K-Means Analysis Different from Variance?

I'm working on a project that requires some clustering analysis. In performing the analysis, I noticed something that seemed odd to me. I understand that in k-means the total sum of squares (total ...
0 votes
0 answers
964 views

Calculate Probability of Membership from kmeans in R

How can I calculate the probability of membership with R's kmeans output? The output of kmeans is as follows: ...