0

I have had use case for a fuzzy logic. I want to recommend a product based on needs. However my logic always errors, even though there should be enough rules.


AssertionError Traceback (most recent call last) File ~/opt/anaconda3/lib/python3.9/site-packages/skfuzzy/control/controlsystem.py:586, in CrispValueCalculator.defuzz(self) 585 try: --> 586 return defuzz(ups_universe, output_mf, 587 self.var.defuzzify_method) 588 except AssertionError:

File ~/opt/anaconda3/lib/python3.9/site-packages/skfuzzy/defuzzify/defuzz.py:248, in defuzz(x, mfx, mode) 247 zero_truth_degree = mfx.sum() == 0 # Approximation of total area --> 248 assert not zero_truth_degree, 'Total area is zero in defuzzification!' 250 if 'centroid' in mode:

AssertionError: Total area is zero in defuzzification!

During handling of the above exception, another exception occurred:

  • Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Community Jul 15 '23 at 20:57

1 Answers1

1

Your program gives an error because it doesn't have a rule for every possible situation. It's like trying to play a board game but you don't have instructions for every possible move.

To fix it, you could either:

  1. Add more rules: This is like adding more instructions to your game.
  2. Add a default rule.
  3. Change your membership functions: If the criteria are too specific, a rule might never get used.
algorythms
  • 1,547
  • 1
  • 15
  • 28