Zadeh-Mamdani Rules

class fuzzy_expert.rule.FuzzyRule(premise, consequence, cf=1.0, threshold_cf=0)[source]

Bases: object

Creates a Zadeh-Mamdani fuzzy rule.

Parameters
  • premise – List of propositions in rule premise.

  • consequence – List of propositions in rule consequence.

  • cf – Certainty factor of the rule.

  • threshold_cf – Minimum certainty factor for rule firing.

>>> from fuzzy_expert.rule import FuzzyRule
>>> rule = FuzzyRule(
...     premise=[
...         ("score", "High"),
...         ("AND", "ratio", "Goodr"),
...         ("AND", "credit", "Goodc"),
...     ],
...     consequence=[("decision", "Approve")],
... )
>>> rule
IF  score IS High
    AND ratio IS Goodr
    AND credit IS Goodc
THEN
    decision IS Approve
CF = 1.00
Threshold-CF = 0.00