Re: how to group by function if one of the group has relationship with another one in the group?

2017-08-04 Thread Ho Yeung Lee
On Wednesday, August 2, 2017 at 5:25:21 AM UTC+8, Piet van Oostrum wrote: > Ho Yeung Lee writes: > > > which function should be used for this problem? > > > I think it is a kind if clustering, or a connectivity problem. There are > special algorithms for that, not just a simple function. Maybe s

Re: how to group by function if one of the group has relationship with another one in the group?

2017-08-01 Thread Piet van Oostrum
Ho Yeung Lee writes: > which function should be used for this problem? > I think it is a kind if clustering, or a connectivity problem. There are special algorithms for that, not just a simple function. Maybe scikit-learn has a suitable algorithm for it. -- Piet van Oostrum WWW: http://piet.v

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-30 Thread Ho Yeung Lee
which function should be used for this problem? On Saturday, July 29, 2017 at 11:02:30 PM UTC+8, Piet van Oostrum wrote: > Peter Otten <__pete...@web.de> writes: > > > Ho Yeung Lee wrote: > > > >> from itertools import groupby > >> > >> testing1 = [(1,1),(2,3),(2,4),(3,5),(3,6),(4,6)] > >> def i

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-29 Thread Piet van Oostrum
Peter Otten <__pete...@web.de> writes: > Ho Yeung Lee wrote: > >> from itertools import groupby >> >> testing1 = [(1,1),(2,3),(2,4),(3,5),(3,6),(4,6)] >> def isneighborlocation(lo1, lo2): >> if abs(lo1[0] - lo2[0]) == 1 or lo1[1] == lo2[1]: >> return 1 >> elif abs(lo1[1] - lo2[1]

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-28 Thread Ho Yeung Lee
actually i used in this application if same color is neighbor like connected then group them i use for segmentation of words in screen capture https://stackoverflow.com/questions/45294829/how-to-group-by-function-if-any-one-of-the-group-members-has-neighbor-relationsh i asked here too, but i do

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-28 Thread Ho Yeung Lee
actually i used in this application if same color is neighbor like connected then group them i use for segmentation of words in screen capture https://stackoverflow.com/questions/45294829/how-to-group-by-function-if-any-one-of-the-group-members-has-neighbor-relationsh i asked here too, but i do

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-25 Thread ast
"Ho Yeung Lee" a écrit dans le message de news:ef0bd11a-bf55-42a2-b016-d93f3b831...@googlegroups.com... from itertools import groupby testing1 = [(1,1),(2,3),(2,4),(3,5),(3,6),(4,6)] def isneighborlocation(lo1, lo2): if abs(lo1[0] - lo2[0]) == 1 or lo1[1] == lo2[1]: return 1 eli

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-25 Thread Peter Otten
Ho Yeung Lee wrote: > from itertools import groupby > > testing1 = [(1,1),(2,3),(2,4),(3,5),(3,6),(4,6)] > def isneighborlocation(lo1, lo2): > if abs(lo1[0] - lo2[0]) == 1 or lo1[1] == lo2[1]: > return 1 > elif abs(lo1[1] - lo2[1]) == 1 or lo1[0] == lo2[0]: > return 1 >

how to group by function if one of the group has relationship with another one in the group?

2017-07-24 Thread Ho Yeung Lee
from itertools import groupby testing1 = [(1,1),(2,3),(2,4),(3,5),(3,6),(4,6)] def isneighborlocation(lo1, lo2): if abs(lo1[0] - lo2[0]) == 1 or lo1[1] == lo2[1]: return 1 elif abs(lo1[1] - lo2[1]) == 1 or lo1[0] == lo2[0]: return 1 else: return 0 groupda = g