Skip to content
Snippets Groups Projects
Commit 26ca6d7f authored by mbaumBielefeld's avatar mbaumBielefeld
Browse files

Did something in ProbabilityTable.division() but isnt finished

parent 2e42b1f4
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ transition_model = GibbsTransitionModel() ...@@ -29,7 +29,7 @@ transition_model = GibbsTransitionModel()
mcs = MarkovChainSampler() mcs = MarkovChainSampler()
initial_state={burglary:"Safe",alarm:"Silent"} initial_state={burglary:"Safe",alarm:"Silent"}
chain = mcs.generateMarkovChain(bn, 1000000, transition_model, initial_state) chain = mcs.generateMarkovChain(bn, 5000, transition_model, initial_state)
#for c in chain: #for c in chain:
# print c # print c
...@@ -44,7 +44,7 @@ print pt ...@@ -44,7 +44,7 @@ print pt
print "----burglary----" print "----burglary----"
print pt.marginalization(alarm) print pt.marginalization(alarm)
print "----alarm----" print "----alarm----"
print pt.division(burglary) print pt.division(burglary.get_cpd())
bn.draw() bn.draw()
...@@ -173,7 +173,15 @@ class ProbabilityTable(Density): ...@@ -173,7 +173,15 @@ class ProbabilityTable(Density):
def division(self, factor): def division(self, factor):
'''Returns a new ProbabilityTable which is the result of dividing this one by the one given '''Returns a new ProbabilityTable which is the result of dividing this one by the one given
with the argument factor''' with the argument factor'''
divided = ProbabilityTable()
variables = list(set(self.variables) | set(factor.variables))
for variable in variables:
divided.add_variable(variable)
for variable in variables:
for value in variable.get_value_range():
index = "lol"
raise Exception("Sorry, called unimplemented method ProbabilityTable.division()")
def __str__(self): def __str__(self):
return str(self.table) return str(self.table)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment