#NEWLINE# def PriorityProbability( self , example_to_softlabel ) : #NEWLINE# #INDENT# label_to_priority_probability = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( _ , softlabel ) in example_to_softlabel . items ( ) : #NEWLINE# #INDENT# for ( label , probability ) in softlabel . items ( ) : #NEWLINE# #INDENT# label_to_priority_probability [ probability ] = ( label_to_priority_probability . get ( label , 0 ) + probability ) #NEWLINE# #UNINDENT# #UNINDENT# for ( label , count ) in label_to_priority_probability . items ( ) : #NEWLINE# #INDENT# label_to_priority_probability [ label ] = ( ( count * 1.0 ) / len ( example_to_softlabel ) ) #NEWLINE# #UNINDENT# return label_to_priority_probability