Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pybn/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def getSize(self):
def printNode(self):
# print node
commentNode = '\t\t<!-- create node "'+self.caption+'" -->\n'
initNode = '\t\t<cpt id="'+self.name+'" >\n'
initNode = '\t\t<cpt id="'+self.nodeId+'" >\n'
commentOutcomes = '\t\t\t<!-- setting names of outcomes -->\n'
initOutcomes = ''
for outcome in self.outcomes:
Expand All @@ -477,7 +477,7 @@ def printNode(self):
commentArc = '\t\t\t<!-- add arcs -->\n'
initArc = '\t\t\t<parents>'
for connection in self.arcConnection:
initArc += connection[0]+' '
initArc += connection[1]+' '
endArc = '</parents>\n'
else:
commentArc = ''
Expand All @@ -495,7 +495,7 @@ def printNode(self):
return print_node

def printExtension(self):
initExtensions = '\t\t\t<node id="'+self.name+'">\n'
initExtensions = '\t\t\t<node id="'+self.nodeId+'">\n'
initName = '\t\t\t\t<name>'+self.caption+'</name>\n'
initIcolor = '\t\t\t\t<interior color="'+self.interior_color+'" />\n'
initOcolor = '\t\t\t\t<outline color="'+self.outline_color+'" />\n'
Expand All @@ -508,7 +508,7 @@ def printExtension(self):
return initExtensions+initName+initIcolor+initOcolor+initFont+initPos+initBar+endExtensions

def printProbabilities(self):
commentProbabilities = '// setting probabilities for "'+self.name+'"\ntheProbs.Flush();\n'
commentProbabilities = '// setting probabilities for "'+self.nodeId+'"\ntheProbs.Flush();\n'
initProbabilities = 'theProbs.SetSize('+str(len(self.probability))+');\n'
for i,probability in enumerate(self.probability):
initProbabilities += 'theProbs['+str(i)+'] = '+str(probability)+';\n'
Expand Down Expand Up @@ -622,7 +622,7 @@ class Arc(object):
def __init__(self, from_node, to_node):
self.from_node = from_node
self.to_node = to_node
self.to_node.addArcConnection(self.from_node.getName(),self.from_node.getIdNum(),self.from_node.getSize())
self.to_node.addArcConnection(self.from_node.getName(),self.from_node.getNodeId(),self.from_node.getSize())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes what gets into the var of a node
This change might actually break how computeBeliefs work
Thus it is not necessary to make this change, even if redesigning computeBeliefs would be better in the long run


def __repr__(self):
return self.name
Expand Down