Commit 78a4eb51 authored by Michele's avatar Michele

fixed problem of creating hypotheses with not enabled inputs

parent c22861cf
......@@ -324,12 +324,10 @@ class LearningAlgorithm:
assignments[row] = count
count = count + 1
allLabels = self._teacher.getInputAlphabet().union(
self._teacher.getOutputAlphabet(),
set((self._teacher.getQuiescence(),)))
# add transitions
for row in rows:
allLabels = self._getAllLabels(row)
for label in allLabels:
# create row and search it in the table
extension = row + (label,)
......@@ -347,6 +345,7 @@ class LearningAlgorithm:
# Either the table is not closed, or
# First column of extension has an empty set.
# If label is an input, then send it to ChaosDelta
# - unless it is not enabled.
# If it is an output, then send it to Chaos
# It cannot be quiescence
if label in self._teacher.getInputAlphabet():
......@@ -373,6 +372,13 @@ class LearningAlgorithm:
hyp.getChaosDelta())
return hyp
# Get all labels enabled after row
def _getAllLabels(self, row):
allLabels = self._teacher.getInputAlphabet().union(
self._teacher.getOutputAlphabet(),
set((self._teacher.getQuiescence(),)))
return allLabels
# Generate DOT files for hypotheses. hyp = hMinus|hPlus|both
def generateDOT(self, path=None, hyp="both", format="pdf"):
if path == None:
......@@ -546,3 +552,19 @@ class LearningAlgorithm2Sets(LearningAlgorithm):
closeStrategy, logger=logger,
outputPurpose=outputPurpose,
inputPurpose=inputPurpose)
self._inputPurpose = inputPurpose
self._outputPurpose = outputPurpose
# Get all labels enabled after row
# check input enabledness
def _getAllLabels(self, row):
enabledInputs = self._teacher.getInputAlphabet()
enabledOutputs = self._teacher.getOutputAlphabet()
if self._inputPurpose != None:
enabledInputs = self._inputPurpose.getEnabled(row)
if self._outputPurpose != None:
enabledOutputs = self._outputPurpose.getEnabled(row)
allLabels = enabledInputs.union(enabledOutputs,
set((self._teacher.getQuiescence(),)))
return allLabels
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment