cluster-analysis

Forming a symmetric matrix counting instances of being in same cluster

Forming a symmetric matrix counting instances of being in same cluster Question: I have a database that comprises cities divided into clusters for each year. In other words, I applied a community detection algorithm for different databases containing cities in different years base on modularity. The final database (a mock example) looks like this: v1 …

Total answers: 2

How to make KMeans Clustering more Meaningful for Titanic Data?

How to make KMeans Clustering more Meaningful for Titanic Data? Question: I’m running this code. import pandas as pd titanic = pd.read_csv(‘titanic.csv’) titanic.head() #Import required module from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.cluster import KMeans from sklearn.metrics import adjusted_rand_score documents = titanic[‘Name’] vectorizer = TfidfVectorizer(stop_words=’english’) X = vectorizer.fit_transform(documents) from sklearn.cluster import KMeans # initialize kmeans with …

Total answers: 1

TypeError: 'float' object is not iterable with the evaluation of the clustering quality

TypeError: 'float' object is not iterable with the evaluation of the clustering quality Question: I have an array that looks: matrix =np.array([[0, 0.0784, 0.032768, 0.097216, 0.131008, 0.025792], [0.0784 , 0, 0.142144, 0.16768 , 0.223104, 0.174848], [0.032768, 0.142144, 0, 0.069312, 0.126656, 0.053056], [0.097216, 0.16768 , 0.069312, 0, 0.212224, 0.095232], [0.131008, 0.223104, 0.126656, 0.212224, 0, 0.173312], [0.025792, …

Total answers: 2

How to get the clusters from Affinity propagation algorithm?

How to get the clusters from Affinity propagation algorithm? Question: I want the data points after using AP clustering as a 3d nparray. First index to access the clusters, second and third index to access the clustered data. I am using the sklearn library function. af = AffinityPropagation().fit(X) Asked By: rk6t7 || Source Answers: You …

Total answers: 1

Why does sklearn KMeans changes my dataset after fitting?

Why does sklearn KMeans changes my dataset after fitting? Question: I am using the KMeans from sklearn to cluster the College.csv. But when I fit the KMeans model, my dataset changes after that! Before using KMeans, I Standardize the numerical variables with StandardScaler and I use OneHotEncoder to dummy the categorical variable "Private". My code …

Total answers: 3

Generating three new features (membership class) based on probability clustering

Generating three new features (membership class) based on probability clustering Question: I have a column of 100,000 temperatures with a minimum of 0°F and maximum of 130°F. I want to create three new columns (features) based on that temperature column for my model based on probability of membership to a cluster (I think it is …

Total answers: 1

How do I extract values from Python groupby for data analysis?

How do I extract values from Python groupby for data analysis? Question: New to python and I am using Spotify’s spotipy package in Python to try and create a "music taste diversity score" for my top spotify artists. I have clustered all the artists songs based on 7 of spotify’s built in features and displayed …

Total answers: 1

How to Show "Fuzziness" in Fuzzy Clustering Plot Python

How to Show "Fuzziness" in Fuzzy Clustering Plot Python Question: I have a normally distributed 2D dataset, and I am using the fcmeans library to perform fuzzy c-means clustering. I am able to plot the clusters with the red point indicating the cluster center. However, I need to show a gradient where the fuzziness occurs. …

Total answers: 1

Xie-Beni Index: Clusters-Features 1.0.3 python library unavailable in pip install

Xie-Beni Index: Clusters-Features 1.0.3 python library unavailable in pip install Question: I am trying to use ‘Xie-Beni Index’ from the Clusters-Features library available here: https://pypi.org/project/Clusters-Features/ through the following code: pip install Clusters-Features However, I am getting the following error. Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ ERROR: Could not find a version that satisfies the requirement Clusters-Features==1.0.2 …

Total answers: 2

How to dynamically change color of selected category using dropdown box?

How to dynamically change color of selected category using dropdown box? Question: I am working on an app that takes in 2 inputs to update a scatterplot displaying the results of a cluster analysis. The first input filters the points on the graph through a time range slider. The second input is a dropdown box …

Total answers: 1