MCPcopy Create free account
hub / github.com/CyberPoint/libpgm / sumproductve

Method sumproductve

libpgm/tablecpdfactorization.py:102–122  ·  view source on GitHub ↗

Eliminate each vertex in *vertices* from *factorlist* using *sumproducteliminatevar*. Arguments: 1. *vertices* -- A list of UUIDs of vertices to be eliminated. Attributes modified: 1. *factorlist* -- modified to become a single fact

(self, vertices)

Source from the content-addressed store, hash-verified

100 self.factorlist = factors2
101
102 def sumproductve(self, vertices):
103 '''
104 Eliminate each vertex in *vertices* from *factorlist* using *sumproducteliminatevar*.
105
106 Arguments:
107 1. *vertices* -- A list of UUIDs of vertices to be eliminated.
108
109 Attributes modified:
110 1. *factorlist* -- modified to become a single factor representing the remaining variables.
111
112 '''
113
114 # eliminate one by one
115 for vertex in vertices:
116 self.sumproducteliminatevar(vertex)
117
118 # multiply together if many factors remain
119 for i in range(1, len(self.factorlist)):
120 self.factorlist[0].multiplyfactor(self.factorlist[i])
121
122 self.factorlist = self.factorlist[0]
123
124 def condprobve(self, query, evidence):
125 '''

Callers 2

condprobveMethod · 0.95
test_sumproductveMethod · 0.80

Calls 2

multiplyfactorMethod · 0.80

Tested by 1

test_sumproductveMethod · 0.64