I need to input 3, 3D points as a matrix into this function; so I made a tuple like this one:
initPoints = ([10,20,30],[5,15,25],[100,150,200])
but I got the following error:
AttributeError: 'tuple' object has no attribute 'shape'
The same thing happened when i used a list. any ideas? what is ‘shape’? do i need some other kind of array? How can I do that?
Thanks
Edit – the function I’m using is scipy.cluster.vq.kmeans2 with minit=’matrix’
As the docs to
scipy.cluster.vq.kmeans2indicate,kshould be anumpy.ndarraywhen you pass inminit='matrix'. So do this: