Issue 746 in nltk: nltk clustering with svd: matrices are not aligned error

14 views
Skip to first unread message

nl...@googlecode.com

unread,
Jun 12, 2013, 3:31:24 PM6/12/13
to nltk-...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 746 by mohsen.f...@gmail.com: nltk clustering with svd: matrices
are not aligned error
http://code.google.com/p/nltk/issues/detail?id=746

What version of NLTK are you using? (See nltk.__version__). Please only
submit bug reports for the current version.

I am using NLTK version 2.0.4 with numpy version 1.6.1

What steps will reproduce the problem? (e.g. include Python source code)

I am trying to run k-means clustering with svd for dimensionality
reduction. It seems that the current version of clustering has an error.
This is the example that I am running:

wDocTerm = np.array([[1,2,3,4,5],[0, -1, 2, 2.4, -1],[1, 2, -1, 0, 0],[1.3,
0, 0, 1, 2],[2.2, 0, 1.3, 1.5, 0.5],[2, 1.2, 1.3, 0, 0],[0.9, 0.8, 0, 1,
2],[1.7, 0.6, 2, 1.1, 1.6],[1,4, 3, 0.3, 0.5],[0.7, 0.5, 0.3, 0.2, 0.1]])
distance = euclidean_distance
repeats = 10
initial_means = None
num_means = 2
avoid_empty_clusters = True
svd_dim = 2
KMclusterer = cluster.KMeansClusterer(num_means, distance, repeats,
conv_test=9.9999999999999995e-07, initial_means=None, normalise=False,
svd_dimensions= svd_dim, rng=None, avoid_empty_clusters=True)
st = time.time()
clusters = KMclusterer.cluster(wDocTerm[:,:], True)
ed = time.time()

What is the expected output? What do you see instead?
These are the errors:

clusters = KMclusterer.cluster(wDocTerm[:,:], True)
File "/Library/Python/2.7/site-packages/nltk/cluster/util.py", line 60,
in cluster
return [self.classify(vector) for vector in vectors]
File "/Library/Python/2.7/site-packages/nltk/cluster/util.py", line 72,
in classify
vector = numpy.dot(self._Tt, vector)
ValueError: matrices are not aligned

Please use labels and text to provide additional information.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages