Skip to content

Defuzzifier

Bisector

Bases: IntegralDefuzzifier

Integral defuzzifier that computes the bisector of a fuzzy set.

related

Functions

defuzzify

defuzzify(term: Term, minimum: float, maximum: float) -> Scalar

Compute the bisector of a fuzzy set, that is, the x-coordinate such that the area to its left is approximately equal to the area to its right.

The defuzzification process integrates over the fuzzy set using the given range. The integration algorithm is the midpoint rectangle method (https://en.wikipedia.org/wiki/Rectangle_method).

Parameters:

Name Type Description Default
term Term

fuzzy set to defuzzify

required
minimum float

value to start defuzzification

required
maximum float

value to end defuzzification

required

Returns:

Type Description
Scalar

\(x\)-coordinate of the bisector of the fuzzy set

Centroid

Bases: IntegralDefuzzifier

Integral defuzzifier that computes the centroid of a fuzzy set.

related

Functions

defuzzify

defuzzify(term: Term, minimum: float, maximum: float) -> Scalar

Compute the centroid of a fuzzy set.

The defuzzification process integrates over the fuzzy set using the given range. The integration algorithm is the midpoint rectangle method (https://en.wikipedia.org/wiki/Rectangle_method).

Parameters:

Name Type Description Default
term Term

fuzzy set to defuzzify

required
minimum float

value to start defuzzification

required
maximum float

value to end defuzzification

required

Returns:

Type Description
Scalar

\(x\)-coordinate of the centroid of the fuzzy set

Defuzzifier

Bases: ABC

Abstract class for defuzzifiers.

related

Functions

__repr__

__repr__() -> str

Return the code to construct the defuzzifier in Python.

Returns:

Type Description
str

code to construct the defuzzifier in Python.

__str__

__str__() -> str

Return the code to construct the defuzzifier in the FuzzyLite Language.

Returns:

Type Description
str

code to construct the defuzzifier in the FuzzyLite Language.

configure

configure(parameters: str) -> None

Configure the defuzzifier with the parameters.

Parameters:

Name Type Description Default
parameters str

space-separated parameter values

required

defuzzify abstractmethod

defuzzify(term: Term, minimum: float, maximum: float) -> Scalar

Defuzzify the term using the range [minimum,maximum].

Parameters:

Name Type Description Default
term Term

term to defuzzify, typically an Aggregated term

required
minimum float

minimum value of the range

required
maximum float

maximum value of the range

required

Returns:

Type Description
Scalar

defuzzified value of the term.

parameters

parameters() -> str

Return the space-separated parameters of the defuzzifier.

Returns:

Type Description
str

space-separated parameters of the defuzzifier.

IntegralDefuzzifier

Bases: Defuzzifier

Abstract class for defuzzifiers that integrate over the fuzzy set.

related

Attributes

default_resolution class-attribute instance-attribute

default_resolution: Final[int] = 1000

resolution instance-attribute

Functions

__init__

__init__(resolution: int | None = None) -> None

Constructor.

Parameters:

Name Type Description Default
resolution int | None

number of divisions to discretize the range and compute the area under the curve.

None

__repr__

__repr__() -> str

Return the code to construct the defuzzifier in Python.

Returns:

Type Description
str

code to construct the defuzzifier in Python.

configure

configure(parameters: str) -> None

Configure the defuzzifier with the parameters.

Parameters:

Name Type Description Default
parameters str

list of space-separated parameter values

required

defuzzify abstractmethod

defuzzify(term: Term, minimum: float, maximum: float) -> Scalar

Implement the defuzzification of the term using the given range.

Parameters:

Name Type Description Default
term Term

term to defuzzify

required
minimum float

value to start defuzzification

required
maximum float

value to end defuzzification

required

Returns:

Type Description
Scalar

defuzzified value.

parameters

parameters() -> str

Return the parameters to configure the defuzzifier.

Returns:

Type Description
str

parameters to configure the defuzzifier.

LargestOfMaximum

Bases: IntegralDefuzzifier

Integral defuzzifier that computes the largest value of the maximum membership function of a fuzzy set.

related

Functions

defuzzify

defuzzify(term: Term, minimum: float, maximum: float) -> Scalar

Compute the largest value of the maximum membership function of a fuzzy set.

The defuzzification process integrates over the fuzzy set using the given range. The integration algorithm is the midpoint rectangle method (https://en.wikipedia.org/wiki/Rectangle_method).

Parameters:

Name Type Description Default
term Term

fuzzy set to defuzzify

required
minimum float

value to start defuzzification

required
maximum float

value to end defuzzification

required

Returns:

Type Description
Scalar

largest \(x\)-coordinate of the maximum membership function value in the fuzzy set

MeanOfMaximum

Bases: IntegralDefuzzifier

Integral defuzzifier that computes the mean value of the maximum membership function of a fuzzy set.

related

Functions

defuzzify

defuzzify(term: Term, minimum: float, maximum: float) -> Scalar

Compute the mean value of the maximum membership function of a fuzzy set.

The defuzzification process integrates over the fuzzy set using the given range. The integration algorithm is the midpoint rectangle method (https://en.wikipedia.org/wiki/Rectangle_method).

Parameters:

Name Type Description Default
term Term

fuzzy set to defuzzify

required
minimum float

value to start defuzzification

required
maximum float

value to end defuzzification

required

Returns:

Type Description
Scalar

mean \(x\)-coordinate of the maximum membership function value in the fuzzy set

SmallestOfMaximum

Bases: IntegralDefuzzifier

Integral defuzzifier that computes the smallest value of the maximum membership function of a fuzzy set.

related

Functions

defuzzify

defuzzify(term: Term, minimum: float, maximum: float) -> Scalar

Compute the smallest value of the maximum membership function in the fuzzy set.

The defuzzification process integrates over the fuzzy set using the given range. The integration algorithm is the midpoint rectangle method (https://en.wikipedia.org/wiki/Rectangle_method).

Parameters:

Name Type Description Default
term Term

fuzzy set to defuzzify

required
minimum float

value to start defuzzification

required
maximum float

value to end defuzzification

required

Returns:

Type Description
Scalar

smallest \(x\)-coordinate of the maximum membership function value in the fuzzy set

WeightedAverage

Bases: WeightedDefuzzifier

Weighted defuzzifier that computes the weighted average of a fuzzy set represented by an Aggregated term.

related

Functions

defuzzify

defuzzify(term: Term, minimum: float = nan, maximum: float = nan) -> Scalar

Computes the weighted average of the fuzzy set.

The fuzzy set is represented by an Aggregated Term as \(y = \sum_i{w_iz_i}\), where \(w_i\) is the activation degree of term \(i\), and \(z_i = \mu_i(w_i)\).

In Takagi-Sugeno controllers, the membership function \(\mu_i(w_i)\) is generally a Constant, Linear, or Function term, which typically disregards the \(w_i\) value.

Warning

From version 8, the aggregation operator is used to aggregate multiple activations of the same term.

In previous versions, the implication and aggregation operators are not used for weighted defuzzification.

Parameters:

Name Type Description Default
term Term

term to defuzzify

required
minimum float

irrelevant

nan
maximum float

irrelevant

nan

Returns:

Type Description
Scalar

weighted average of the fuzzy set

WeightedDefuzzifier

Bases: Defuzzifier

Abstract class for defuzzifiers that compute a weighted function on the fuzzy set.

related

Attributes

type instance-attribute

type = Type[type]

Classes

Type

Bases: Enum

Type of the weighted defuzzifier based on the terms in the fuzzy set.

  • Automatic: Automatically inferred from the terms
  • TakagiSugeno: Manually set to TakagiSugeno (or Inverse Tsukamoto)
  • Tsukamoto: Manually set to Tsukamoto
Attributes
Automatic class-attribute instance-attribute
Automatic = auto()
TakagiSugeno class-attribute instance-attribute
TakagiSugeno = auto()
Tsukamoto class-attribute instance-attribute
Tsukamoto = auto()
Functions
__repr__
__repr__() -> str

Return the code to identify the type of defuzzifier in Python.

Returns:

Type Description
str

code to identify the type of defuzzifier in Python.

Functions

__init__

__init__(type: str | Type = Automatic) -> None

Constructor.

Parameters:

Name Type Description Default
type str | Type

name or type of the weighted defuzzifier.

Automatic

__repr__

__repr__() -> str

Return the code to construct the defuzzifier in Python.

Returns:

Type Description
str

code to construct the defuzzifier in Python.

configure

configure(parameters: str) -> None

Configure the defuzzifier with the parameters.

Parameters:

Name Type Description Default
parameters str

list of space-separated parameter values

required

defuzzify abstractmethod

defuzzify(term: Term, minimum: float = nan, maximum: float = nan) -> Scalar

Implement the defuzzification of the term.

Warning

From version 8, the aggregation operator is used to aggregate multiple activations of the same term.

In previous versions, the implication and aggregation operators are not used for weighted defuzzification.

Parameters:

Name Type Description Default
term Term

term to defuzzify

required
minimum float

irrelevant

nan
maximum float

irrelevant

nan

Returns:

Type Description
Scalar

defuzzified value

infer_type classmethod

infer_type(component: Term | Variable) -> Type

Infer the type of the defuzzifier based on the component.

Parameters:

Name Type Description Default
component Term | Variable

term or variable to infer the type for

required

Returns:

Type Description
Type

inferred type of the defuzzifier based on the component.

parameters

parameters() -> str

Return the parameters to configure the defuzzifier.

Returns:

Type Description
str

parameters to configure the defuzzifier.

WeightedSum

Bases: WeightedDefuzzifier

Weighted defuzzifier that computes the weighted sum of a fuzzy set represented by an Aggregated term.

related

Functions

defuzzify

defuzzify(term: Term, minimum: float = nan, maximum: float = nan) -> Scalar

Computes the weighted sum of the fuzzy set.

The fuzzy set is represented by Aggregated term as \(y = \sum_i{w_iz_i}\), where \(w_i\) is the activation degree of term \(i\), and \(z_i = \mu_i(w_i)\).

In Takagi-Sugeno controllers, the membership function \(\mu_i(w_i)\) is generally a Constant, Linear, or Function term, which typically disregards the \(w_i\) value.

Warning

From version 8, the aggregation operator is used to aggregate multiple activations of the same term.

In previous versions, the implication and aggregation operators are not used for weighted defuzzification.

Parameters:

Name Type Description Default
term Term

term to defuzzify

required
minimum float

irrelevant

nan
maximum float

irrelevant

nan

Returns:

Type Description
Scalar

weighted sum of the fuzzy set