0

Below code tries to add 2 vertices with both vertices having multiple label values. Then tries to apply label_propagation on label "labelx" to the graph created.

from graphlab import label_propagation
from graphlab import SFrame, SGraph, Vertex, Edge

g = SGraph()
verts = [Vertex('H',attr={'labelx': [1,0]})]
g= g.add_vertices(verts)
verts = [Vertex('I',attr={'labelx': [0,2]})]
g= g.add_vertices(verts)
g = g.add_edges(Edge('H','I'))
print g.summary
m = label_propagation.create(g, label_field='labelx')

But, throws error as TypeError: TypeErro...typed.',)

In the documentation of Labelpropagation, i could not find multi label support information anywhere. Any hints on how to resolve the problem are welcome. If graphlab.label_propagation does not support multilabels on vertices, any directions on other packages which offers this functionality will be very helpful.

Thanks!

viva
  • 103
  • 2
  • 12
  • 1
    I'm not quite sure what your question is - the code you posted works fine for me. Are you asking about *updating* the values in the 'labelx' attribute? – papayawarrior Jan 21 '16 at 18:49
  • Yes, it works. My bad for not testing correctly. The problem lies in Label_propagation and not in the SGraph(). This is the actual problem and any hints are welcome. Updated the question accordingly. – viva Jan 22 '16 at 02:10
  • Yeah, graphlab label propagation only works with integer class labels, so this won't work. What behavior would you like to see with multi-label inputs like this? I can't tell if you're initializing vertices with multiple labels or if you want to run label prop. on two different attributes. If it's the second case, you could make two attribute fields and run label prop twice. For the first case, I don't have a great answer, but one idea is to split the labeled nodes into two, one with each of the known labels, and connect them to the same edges. – papayawarrior Jan 22 '16 at 06:38
  • Hi @papayawarrior, Thanks for getting back. Mine is the first case. I have nearly 80% of vertices with multiple label values/label, with some having more than 5 label values/label. I will definitely try your suggestion (of splitting the labelled nodes), though i am not sure how well its going to work. – viva Jan 22 '16 at 08:07
  • Hi @papayawarrior, Any ideas on GraphChi, which supports having multiple label values, with each label value having a probability/vertex as described in [link](http://bickson.blogspot.com.au/2013/02/label-propagation-in-graphchi.html). A vertex with 2 label values will have 0.5 probability/label value, i suppose. Any thoughts on this are much appreciated. Thanks! – viva Jan 22 '16 at 08:08

0 Answers0