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)
| 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 | ''' |