The old Google Groups will be going away soon, but your browser is incompatible with the new version.
propagation algorithm
 There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic. There was an error processing your request. Please try again. Standard view   View as tree
 1 message

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options Sep 12 2012, 9:24 am
From: Goog Cheng <googch...@gmail.com>
Date: Wed, 12 Sep 2012 21:24:54 +0800
Local: Wed, Sep 12 2012 9:24 am
Subject: propagation algorithm

Hi,pal! I wanna use networkx to calculate the sentiment strength of a
wordnet by a propagation algorithm(it seems to be belief
propagation),but didnt get a good result. Is there a problem of my
implement?Any guidance would be greatly appreciated.

here is my code :
/#init the strength //
//for n in DG://
//    if DG.in_degree(n)==0://
//        if dictpos.get(n.encode('utf8'))://
//            DG.node[n]['s'] = 1//
//        else://
//            DG.node[n]['s'] = -1//
//    else://
//        DG.node[n]['s']=0//
//#iter 12 times//
//for i in range(12)://
//    maxs=0//
//    for n in DG://
//        if DG.in_degree(n)==0://
//            continue//
//        else://
//            neighbors=DG.predecessors(n)//
//            for nb in neighbors: //
//                w=DG[nb][n]['weight'] /
DG.out_degree(nb,weight='weight')//
//                DG.node[n]['s']+=w*DG.node[nb]['s']//
//            if abs(DG.node[n]['s'])>maxs://
//                maxs=abs(DG.node[n]['s'])//
//    #normalize the strength//
//    for n in DG://
//        DG.node[n]['s']/=maxs/