ex_fuzzy.rules.RuleBaseT2#

class ex_fuzzy.rules.RuleBaseT2(antecedents, rules, consequent=None, tnorm=<function prod>)[source]#

Bases: RuleBase

Class optimized to work with multiple rules at the same time. Supports only one consequent. (Use one rulebase per consequent to study classification problems. Check MasterRuleBase class for more documentation)

This class supports iv approximation for t2 fs.

__init__(antecedents, rules, consequent=None, tnorm=<function prod>)[source]#

Constructor of the RuleBaseT2 class.

Parameters:
  • antecedents (list[fuzzyVariable]) – list of fuzzy variables that are the antecedents of the rules.

  • rules (list[RuleSimple]) – list of rules.

  • consequent (fuzzyVariable) – fuzzy variable that is the consequent of the rules.

  • tnorm – t-norm used to compute the fuzzy output.

inference(x)[source]#

Computes the iv output of the t2 inference system.

Return an array in shape samples x 2 (last is iv dimension)

Parameters:

x (array) – array with the values of the inputs.

Returns:

array with the memberships of the consequents for each sample.

Return type:

array

forward(x)[source]#

Computes the deffuzified output of the t2 inference system.

Return a vector of size (samples, )

Parameters:

x (array) – array with the values of the inputs.

Returns:

array with the deffuzified output for each sample.

Return type:

array

fuzzy_type()[source]#

Returns the correspoing type of the RuleBase using the enum type in the fuzzy_sets module.

Returns:

the corresponding fuzzy set type of the RuleBase.

Return type:

FUZZY_SETS