pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.31k stars 17.8k forks source link

Related to clustering of protein using SOMclust #18061

Closed ge5738 closed 6 years ago

ge5738 commented 6 years ago

clust = SOMclust.clusters(umat, bmus, som.smap)

Problem description

100.00/100: flooding: 2499/2499, 127828.70, (120, 130)


TypeError Traceback (most recent call last)

in () ----> 1 clust = SOMclust.clusters(umat, bmus, som.smap) /home/ishrat/SOM/SOMclust.pyc in __init__(self, umatrix, bmus, smap, waterstop) 39 self.x_offset, self.y_offset, self.mask = (None, None, None) 40 self.umatrix = umatrix ---> 41 self.umat_cont, self.x_offset, self.y_offset, self.mask, self.waterlevels, self.flooding = self.flood(umatrix, verbose = True, waterstop=waterstop) 42 self.bmus = bmus 43 self.som = SOM2.SOM() /home/ishrat/SOM/SOMclust.pyc in flood(self, inputmat, x_offset, y_offset, mask, verbose, waterstop, startingpoint, floodgate) 120 break 121 if not floodgate: --> 122 mask, x_offset, y_offset = arrange(circummat) 123 a = matexpand[x_offset] 124 out = a[:,y_offset] /home/ishrat/SOM/SOMclust.pyc in arrange(outmatrix) 48 (x_offset, y_offset, mask) = (self.x_offset, self.y_offset, self.mask) 49 def arrange(outmatrix): ---> 50 x_offset = -(outmatrix==0).all(axis=1) 51 y_offset = -(outmatrix==0).all(axis=0) 52 mask = outmatrix == 0 TypeError: The numpy boolean negative, the `-` operator, is not supported, use the `~` operator or the logical_not function instead. ​ ​
gfyoung commented 6 years ago

@ge5738 : Thanks for reporting this issue! Unfortunately, this is very hard to debug and understand. Could you provide a reproducible example for us to look at? Otherwise, it's tricky to help here.

ge5738 commented 6 years ago

Actuallly i am following the tutorial given on github for SOM. i ahve generated the matrix using som = SOM2.SOM(inputmatrix) and som.learn(verbose=True) command and then save it using numpy.save('smap', som.smap) command. Since this som.smap file contains some negative numbers that's why when i run the command clust = SOMclust.clusters(umat, bmus, som.smap), it gives the following error- TypeError: The numpy boolean negative, the - operator, is not supported, use the ~ operator or the logical_not function instead.

will you please tell me what should i do. Hope you understand my problem,if not then you can also look at http://nbviewer.jupyter.org/gist/bougui505/9955459. your help will be appreciated. Thank you

TomAugspurger commented 6 years ago

Like I said in the other thread, this look unrelated to pandas. You might try asking the somcluster developers.