Octave Fuzzy Logic Toolkit: addrule

### Function Reference: `addrule`

Function File: fis = addrule (fis, rule_matrix)

Add a list of rules to an existing FIS structure and return the updated FIS.

Each row of the rule_matrix represents one rule and has the form:

         [in1_mf ... inM_mf out1_mf ... outN_mf weight connect]

where:

Element in Rule Vector | Expected Type or Value
--- | ---
in<i>_mf | membership function index for input i
out<j>_mf | membership function index for output j
weight | relative weight of the rule (0 <= weight <= 1)
connect | antecedent connective (1 == and; 2 == or)
Hedge String | Effect of Applying Hedge
"not" | prepend a minus sign to the membership function index
"somewhat" | append ".05" to the membership function index
"very" | append ".20" to the membership function index
"extremely" | append ".30" to the membership function index
"very very" | append ".40" to the membership function index
custom hedge | append .xy, where x.y is the degree to which the membership value should be raised, to the membership function index

To omit an input or output, use 0 for the membership function index. The consequent connective is always "and".

For example, to express:

         "If (input_1 is mf_2) or (input_3 is not mf_1) or (input_4 is very mf_1),
          then (output_1 is mf_2) and (output_2 is mf_1^0.3)."

with weight 1, the corresponding row of rule_matrix would be:

         [2   0   -1   4.2   2   1.03   1   2]

For a complete example that uses addrule, see heart_disease_demo_1.m.

See also: heart_disease_demo_1, showrule