Skip to content

Commit

Permalink
Merge pull request #97 from JDWarner/sparse_system_quickfix
Browse files Browse the repository at this point in the history
DOC: Make system too sparse error more informative.
  • Loading branch information
JDWarner committed Apr 5, 2016
2 parents 62666f8 + 2dbb4bf commit eb15e4c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion skfuzzy/control/controlsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,15 @@ def defuzz(self):
raise ValueError("No terms have memberships. Make sure you "
"have at least one rule connected to this "
"variable and have run the rules calculation.")
return defuzz(self.var.universe, output_mf, self.var.defuzzify_method)
try:
return defuzz(self.var.universe, output_mf,
self.var.defuzzify_method)
except AssertionError:
raise ValueError("Crisp output cannot be calculated, likely "
"because the system is too sparse. Check to "
"make sure this set of input values will "
"activate at least one connected Term in each "
"Antecedent via the current set of Rules.")

def fuzz(self, value):
"""
Expand Down

0 comments on commit eb15e4c

Please sign in to comment.