tompollard / sammon

Sammon mapping in Python
32 stars 18 forks source link

Reshaping s array with / division operator results in float which raises an error #6

Closed cidetraq closed 5 years ago

cidetraq commented 6 years ago

In here: # Use step-halving procedure to ensure progress is made

for j in range(maxhalves):
        s_reshape = s.reshape(2,len(s)/2).T`

When I tried to use your function with a matrix of shape (2400, 20) and setting init='random' I got the error

'float' object cannot be interpreted as an integer

To fix this I changed the code to s_reshape = s.reshape(2,len(s)//2).T

I was getting a different error when I left the default setting of init='pca', something like 2 (dim 1) != 1 (dim 0) and I couldn't figure that one out so I went with init='random'.

tompollard commented 6 years ago

Thanks @cidetraq, it's been a while since I looked at this repo, but I'll try to get this bug fixed.

devernay commented 5 years ago

Actually, this code is still wrong for n != 2. This is fixed in https://github.com/tompollard/sammon/pull/8

tompollard commented 5 years ago

Fixed (thanks @devernay!)