From 3f5e87bf21cb9f864ae4bc6cf79b8b9aa648952a Mon Sep 17 00:00:00 2001 From: Manuel Baum <mbaum@techfak.uni-bielefeld.de> Date: Tue, 9 Jul 2013 10:50:31 +0200 Subject: [PATCH] Little refactor: Changed method name to get_unique_value() --- primo/reasoning/Evidence.py | 4 ++-- primo/reasoning/MCMC.py | 2 +- primo/reasoning/MarkovChainSampler.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/primo/reasoning/Evidence.py b/primo/reasoning/Evidence.py index dd3214c..2946061 100644 --- a/primo/reasoning/Evidence.py +++ b/primo/reasoning/Evidence.py @@ -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): diff --git a/primo/reasoning/MCMC.py b/primo/reasoning/MCMC.py index ef48ce6..a2b06a3 100644 --- a/primo/reasoning/MCMC.py +++ b/primo/reasoning/MCMC.py @@ -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 diff --git a/primo/reasoning/MarkovChainSampler.py b/primo/reasoning/MarkovChainSampler.py index d9064d6..b2b792e 100644 --- a/primo/reasoning/MarkovChainSampler.py +++ b/primo/reasoning/MarkovChainSampler.py @@ -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] -- GitLab