Skip to content
Snippets Groups Projects
Commit 3f5e87bf authored by Manuel Baum's avatar Manuel Baum
Browse files

Little refactor: Changed method name to get_unique_value()

parent 3572c578
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ class Evidence(object):
'''
raise Exception("Not defined for this kind of Evidence")
def get_unambigous_value(self):
def get_unique_value(self):
'''
Sometimes only one value of some domain is compatible with the evidence.
This is obviously the case for EvidenceEqual. It is then possible to
......@@ -38,7 +38,7 @@ class EvidenceEqual(Evidence):
def is_compatible(self, value):
return self.value==value
def get_unambigous_value(self):
def get_unique_value(self):
return self.value
class EvidenceIntervall(Evidence):
......
......@@ -120,7 +120,7 @@ class MCMC(object):
state={}
for var in self.bn.get_nodes_in_topological_sort():
if var in evidence.keys():
value=evidence[var].get_unambigous_value()
value=evidence[var].get_unique_value()
if value == None:
value=var.sample_global(state)
state[var]=value
......
......@@ -33,7 +33,7 @@ class GibbsTransitionModel(object):
Dict from Node to Evidence.
'''
nodes = network.get_nodes([])
nodes_to_resample=[n for n in nodes if not n in extern_evidence.keys() or extern_evidence[n].get_unambigous_value() == None]
nodes_to_resample=[n for n in nodes if not n in extern_evidence.keys() or extern_evidence[n].get_unique_value() == None]
for node in nodes_to_resample:
parents=network.get_parents(node)
......@@ -97,7 +97,7 @@ class MetropolisHastingsTransitionModel(object):
Dict from Node to Evidence.
'''
nodes = network.get_nodes([])
nodes_to_resample=[n for n in nodes if not n in extern_evidence.keys() or extern_evidence[n].get_unambigous_value() == None]
nodes_to_resample=[n for n in nodes if not n in extern_evidence.keys() or extern_evidence[n].get_unique_value() == None]
for node in nodes_to_resample:
#propose a new value for this variable:
current_value = state[node]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment