Tag Info

New answers tagged clustering

0

One option to speedup computation with different thresholds is caching the results using the memory option. Something like this: from sklearn.cluster import AgglomerativeClustering clustering = AgglomerativeClustering(compute_full_tree=True, distance_threshold=1.0, memory='mycachedir',...

1

As far as I know, scikit-learn has no library for ensemble clustering. On the other hand, you can apply the method on your dataset as follows: import numpy as np import ClusterEnsembles as CE kmeans1 = np.array([1, 1, 1, 2, 2, 3, 3]) kmeans2 = np.array([2, 2, 2, 3, 3, 1, 1]) kmeans3 = np.array([4, 4, 2, 2, 3, 3, 3]) kmeans4 = np.array([1, 2, np.nan, 1, 2, ...

0

Finding the size of colored regions might be better framed as a convex hull problem since the borders are distinct. After each convex hull is defined, the region can be defined in pixels.

0

Since your data is sequential, you could try with sequential models (LSTM, RNN, GRU) etc. With which you can you predict what the user will select after the set of books as recommendation. In this way the input sequence length can be anything. (like, 3345, 33456, 334567 etc). But to answer your question with KMeans. I assume, all the rows are in same length. ...

1

To address your two questions: Agglomerative clustering requires a distance metric, but you can compute this from your consensus-similarity matrix. The most basic way, is to do this: distance_matrix = 1 / similarity matrix Although, they may explicitly state in the paper what function they use for this transformation. I think this is just to say that the ...

1

Consensus clustering is an additional evaluation technique (i.e. how much consensus is there between clusters), like the Silhouette score, rather than explicit clustering. The clusters themselves would drop out earlier in the processing. The consensus metric is used to test for the best K value, in the K-means clustering algorithm.

0

You can pose this as multi-class classification problem (all sub-clusters becomes classes). Since, your input length varies, you should pad your input to get the length equal for all inputs. You can then use neural networks (1D Conv layers followed by Dense and Softmax) to classify this. An alternate approach to do this would be using tree-based approach ...

0

There might already be a built-in function to compare these outputs you've shown, but one solution would be to just threshold the lists into Boolean lists, and then use logical_and to compare them: import numpy as np def threshold_clusters(teacher_list, threshold = 0.85): return [i>threshold for i in teacher_list] def compare_clusters(first,second): ...

0

You can use these words with their weight as a vector representation of the document. The important point is to make all the documents vectors over the full vocabulary, so that any position $i$ in any vector always represents the same word $w_i$. This means that a vector should contain zeros in all the positions corresponding to a word which is not in the ...

0

You did not mention which package you are using. If you using scikit-learn, sklearn.pipeline.FeatureUnion concatenates results of multiple transformer objects. Something like this: from sklearn.cluster import DBSCAN from sklearn.pipeline import FeatureUnion, Pipeline from skearnsklearn.preprocessing import StandardScaler pipeline = ...

0

Generally, without knowing the source of the data, we can't tell you much about the columns. But I assume the first two columns correspond to $x$ and $y$. The third is probably some meta-data? Maybe a cluster number? For an illustration I found this figure coming from this publication. Maybe that helps you imagine the data's shape. https://www.researchgate....

0

One option is counting patterns. Then define less common occurring patterns as an anomalies. The counting approach is deterministic, whereas clustering is probabilistic. It might solve your problem. If not, it will at least provide summary statistics and a baseline model.

0

Disclaimer: I've never had to cluster using this sparse of data before, but it might be worth using a stacked autoencoder to reduce the data into a latent continuous space. Once reduced, you can cluster the data using traditional methods. Because of the one hot encoding, you'd need a convolutional autoencoder that uses 1d-convolutions for your 2d-inputs.

0

Kullback-Leibler divergence is basically the sum of the relative entropy of two probabilities: vec = scipy.special.rel_entr(p, q) kl_div = np.sum(vec) As mentioned before, just make sure p and q are probability distributions (sum up to 1). You can always normalize them before: p /= np.sum(p) Relative entropy is defined as p*log(p/q), so where q==0, the ...

0

No - PCA and k-means can not be used on categorical variables. Both PCA and k-means require numerical variables.

0

I think I've figured out how to implement the algorithm described in the paper I'm studying. I suspect they used scipy.cluster.hierarchy. Anyway, my process is: Generate a distance matrix y from my list of examples x. Compute the linkage using scipy.cluster.hierarchy.linkage Generate flat clusters using scipy.cluster.hierarchy.fcluster The last step is ...

0

This is a very cool question! Clearly clustering won't work because of time dependent relationships, as you said. I came up with the following algorithm: Have the time series data you have as a list Instantiate an iterator, that will be another list/array that encompasses the time frame you have, e.g. 10 seconds would be an array of length 10, which ...

3

As you point out, the problem is not on the clustering algorithm, but on the features. So the question comes to the particular data you might be dealing with. As an example, say you want to cluster different kind of animals. It is in general much easier to tell an elephant from a horse apart. But if you want to distinguish between races of horses, it gets ...

1

Thank you for the layman explanation, the technical part is a bit hard to follow. As far as I understand, ultimately the goal would be to be able to process these long lists of descriptions and automatically extract a short standardized string for each element in the list. The main choice to make is between supervised classification or unsupervised ...

0

I don't know if I undestrand your question... but, looking at the figure It can be dangerous to extract 5 clusters from this data since they may not be real clusters but a result of missing data... If you are sure there are no missing data in your dataset, doing clustering might be ok if it is what you want to do, but more concerns arise: Is yout input data ...

Top 50 recent answers are included