You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.
Hi, I tried to get the kMedoids function to work on the provided example but when running the following line:
# split into 2 clusters
M, C = kMedoids(D, 2)
I get the following error:
Traceback (most recent call last):
File "/usr/lib/python3.5/code.py", line 91, in runcode
exec(code, self.locals)
File "", line 1, in
File "", line 9, in kMedoids
File "mtrand.pyx", line 4832, in mtrand.RandomState.shuffle
File "mtrand.pyx", line 4835, in mtrand.RandomState.shuffle
TypeError: 'range' object does not support item assignment
Any idea what is causing this? Should it work on Python 3.5?
The text was updated successfully, but these errors were encountered:
##1st change
valid_medoid_inds = [i for i in range(n)]
invalid_medoid_inds = []
rs,cs = np.where(D==0)
# the rows, cols must be shuffled because we will keep the first duplicate below
index_shuf = [i for i in range(len(rs))]
np.random.shuffle(index_shuf)
rs = rs[index_shuf]
cs = cs[index_shuf]
for r,c in zip(rs,cs):
# if there are two points with a distance of 0...
# keep the first one for cluster init
if r < c and r not in invalid_medoid_inds:
invalid_medoid_inds.append(c)
valid_medoid_inds = [i for i in valid_medoid_inds+invalid_medoid_inds if i in valid_medoid_inds and i not in invalid_medoid_inds]
Hi, I tried to get the kMedoids function to work on the provided example but when running the following line:
I get the following error:
Any idea what is causing this? Should it work on Python 3.5?
The text was updated successfully, but these errors were encountered: