I am using t-SNE python implementation for dimensionality reduction on X
which contains 100 instances each described by 1024 parameters for cnn visualization.
X.shape = [100, 1024]
X.dtype = float32
When I run :
Y = tsne.tsne(X)
The first warning pops out in tsne.py, line 23 :
RuntimeWarning: divide by zero encountered in log H = Math.log(sumP) + beta * Math.sum(D * P) / sumP
Then there is a couple more warnings like this one on the following lines :
RuntimeWarning: invalid value encountered in divide
And finally I get this result after each iteration during the processing :
Iteration xyz : error is nan
The code ends without "errors" and I get an empty scatter plot at the end.
EDIT:
-> I have tried it with a different data set and it worked perfectly. However I would need it to work on my first set as well (the one that seems to cause problems)
Question :
Does anyone know what might be causing this? Is there a workaround?
sumP = sum(P)+np.finfo(np.double).eps
H = np.log(sumP) + beta * np.sum(D * P) / sumP;
This should fix the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With