Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Michele Volpato
Alnos
Commits
78a4eb51
Commit
78a4eb51
authored
Oct 22, 2015
by
Michele
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed problem of creating hypotheses with not enabled inputs
parent
c22861cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
learning/learning.py
learning/learning.py
+26
-4
No files found.
learning/learning.py
View file @
78a4eb51
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment