From 4b3ae3fe17f972a3dd655ab9f65b55d9242bae30 Mon Sep 17 00:00:00 2001 From: Nil Geisweiller Date: Wed, 16 Feb 2022 06:52:59 +0200 Subject: [PATCH 1/2] Only enable the entropy filters if thresholds are below max values --- rocca/agents/core.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/rocca/agents/core.py b/rocca/agents/core.py index cff13b4..495657a 100644 --- a/rocca/agents/core.py +++ b/rocca/agents/core.py @@ -1042,26 +1042,28 @@ def is_desirable(self, cogscm: Atom) -> bool: return False # Check that its Shannon entropy is below the maximum threshold - se = shannon_entropy(cogscm, self.prior_a, self.prior_b) - if self.cogscm_maximum_shannon_entropy < se: - agent_log.fine( - msg - + "its Shannon entropy {} is greater than {}".format( - se, self.cogscm_maximum_shannon_entropy + if self.cogscm_maximum_shannon_entropy < 1.0: + se = shannon_entropy(cogscm, self.prior_a, self.prior_b) + if self.cogscm_maximum_shannon_entropy < se: + agent_log.fine( + msg + + "its Shannon entropy {} is greater than {}".format( + se, self.cogscm_maximum_shannon_entropy + ) ) - ) - return False + return False # Check that its differential entropy is below the maximum threshold - de = differential_entropy(cogscm, self.prior_a, self.prior_b) - if self.cogscm_maximum_differential_entropy < de: - agent_log.fine( - msg - + "its differential entropy {} is greater than {}".format( - de, self.cogscm_maximum_differential_entropy + if self.cogscm_maximum_differential_entropy < 0.0: + de = differential_entropy(cogscm, self.prior_a, self.prior_b) + if self.cogscm_maximum_differential_entropy < de: + agent_log.fine( + msg + + "its differential entropy {} is greater than {}".format( + de, self.cogscm_maximum_differential_entropy + ) ) - ) - return False + return False # Check that it has no more variables than allowed mv = vardecl_size(get_vardecl(cogscm)) From 46266e706665ac9e69931f387c09f6cf8497e9a9 Mon Sep 17 00:00:00 2001 From: Nil Geisweiller Date: Wed, 16 Feb 2022 06:54:03 +0200 Subject: [PATCH 2/2] Disable Shannon and Differential entropy filters by default --- rocca/agents/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rocca/agents/core.py b/rocca/agents/core.py index 495657a..01b8720 100644 --- a/rocca/agents/core.py +++ b/rocca/agents/core.py @@ -169,7 +169,7 @@ def __init__( # Shannon entropy below 0.1, but an atom with truth value (stv # 0 0.01) has Shannon entropy above 0.1, and an atom with # truth value (stv 0 0.001) has a Shannon entropy above 0.9. - self.cogscm_maximum_shannon_entropy = 0.9 + self.cogscm_maximum_shannon_entropy = 1.0 # Filter out cognitive schematics with a differential entropy # equal to or lower than this parameter. The differential @@ -190,7 +190,7 @@ def __init__( # This parameter is comparable to # cogscm_maximum_shannon_entropy but better accounts for # confidence. - self.cogscm_maximum_differential_entropy = -1e-1 + self.cogscm_maximum_differential_entropy = 0.0 # Filter out cognitive schematics with numbers of variables # above this threshold