enter image description hereI'm using Python, numpy and scipy to do some hierarchical clustering on the output of a topic model I created for text analysis.
I applied my testcorpus to the ldamodel so it became a bag-of-words representation. Then I turned it into a matrix. Now I want to use scipy to make a linkage matrix of my matrix. But it gives the Value Error: setting an array element with a sequence. I guess that this is because only equally shaped arrays can be clustered. And my matrix has a difference in lengths between the lists inside the list of lists. I just don't now how to solve this. Here is a little part of the code. I don't know if it is helpful. I just really hope someone can help me.
import numpy as np
X = np.array(corpus)
from matplotlib import pyplot as plt
from scipy.cluster.hierarchy import dendrogram, linkage
Z = linkage(X, 'cosine')