From 7416974c000de7d66574e1f5a430c099cfcda992 Mon Sep 17 00:00:00 2001 From: Tamim Burgstaller Date: Wed, 22 Jul 2026 17:11:33 +0200 Subject: [PATCH 1/2] Use EDSM score that ignores outputs that are None Co-authored-by: zwergziege --- .../general_passive/GsmAlgorithms.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/aalpy/learning_algs/general_passive/GsmAlgorithms.py b/aalpy/learning_algs/general_passive/GsmAlgorithms.py index 02d85d4f74..803e47b917 100644 --- a/aalpy/learning_algs/general_passive/GsmAlgorithms.py +++ b/aalpy/learning_algs/general_passive/GsmAlgorithms.py @@ -32,9 +32,18 @@ def run_EDSM(data, automaton_type, input_completeness=None, print_info=True) -> print_level = ProgressReport(1) if print_info else None def EDSM_score(part: Dict[GsmNode, GsmNode]): - nr_partitions = len(set(part.values())) - nr_merged = len(part) - return nr_merged - nr_partitions + reverse_partition = defaultdict(list) + for original_node, resulting_node in part.items(): + reverse_partition[resulting_node].append(original_node) + evidence = 0 + for node, contributing_nodes in reverse_partition.items(): + if node.get_prefix_output() is None: + continue # No evidence whatsoever + evidence -= 1 # subtract self-comparison + for contributing_node in contributing_nodes: + if contributing_node.get_prefix_output() is not None: + evidence += 1 + return evidence score = ScoreCalculation(score_function=EDSM_score) From 55b53d0ffe5c463be2cbe49e9b30f66608c0b849 Mon Sep 17 00:00:00 2001 From: Tamim Burgstaller Date: Wed, 22 Jul 2026 17:26:38 +0200 Subject: [PATCH 2/2] Add missing import --- aalpy/learning_algs/general_passive/GsmAlgorithms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aalpy/learning_algs/general_passive/GsmAlgorithms.py b/aalpy/learning_algs/general_passive/GsmAlgorithms.py index 803e47b917..6ae869d17d 100644 --- a/aalpy/learning_algs/general_passive/GsmAlgorithms.py +++ b/aalpy/learning_algs/general_passive/GsmAlgorithms.py @@ -1,4 +1,4 @@ -from typing import Dict, Union +from typing import Dict, Union, defaultdict from aalpy import DeterministicAutomaton, Onfsm, NDMooreMachine from aalpy.learning_algs.general_passive.GeneralizedStateMerging import run_GSM