Skip to content

Term

Term

Bases: ABC

Abstract class for linguistic terms.

The linguistic terms in this library can be divided into four groups, namely basic, extended, edge, and function.

basic/function extended edge
fuzzylite.term.Discrete fuzzylite.term.Bell fuzzylite.term.Arc
fuzzylite.term.Rectangle fuzzylite.term.Cosine fuzzylite.term.Binary
fuzzylite.term.SemiEllipse fuzzylite.term.Gaussian fuzzylite.term.Concave
fuzzylite.term.Triangle fuzzylite.term.GaussianProduct fuzzylite.term.Ramp
fuzzylite.term.Trapezoid fuzzylite.term.PiShape fuzzylite.term.Sigmoid
fuzzylite.term.Constant fuzzylite.term.SigmoidDifference fuzzylite.term.SShape - fuzzylite.term.ZShape
fuzzylite.term.Linear fuzzylite.term.SigmoidProduct fuzzylite.term.SShape
fuzzylite.term.Function fuzzylite.term.Spike fuzzylite.term.ZShape
related

Attributes

height instance-attribute

height = height

name instance-attribute

name = name

Functions

__init__

__init__(name: str = '', height: float = 1.0) -> None

Constructor.

Parameters:

Name Type Description Default
name str

name of the term

''
height float

height of the term.

1.0

__repr__

__repr__() -> str

Return the code to construct the term in Python.

Returns:

Type Description
str

code to construct the term in Python.

__str__

__str__() -> str

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

Returns:

Type Description
str

code to construct the term in the FuzzyLite Language.

_parameters

_parameters(*args: object) -> str

Concatenate the arguments and the height.

Parameters:

Name Type Description Default
*args object

arguments to configure the term

()

Returns:

Type Description
str

parameters concatenated and an optional height at the end.

_parse

_parse(required: int, parameters: str, *, height: bool = True) -> list[float]

Parse the required values from the parameters.

Parameters:

Name Type Description Default
required int

number of values to parse

required
parameters str

text containing the values

required
height bool

whether parameters contains an extra value for the height of the term

True

Returns:

Type Description
list[float]

list of floating-point values parsed from the parameters.

configure

configure(parameters: str) -> None

Configure the term with the parameters.

The parameters is a list of space-separated values, with an optional value at the end to set the height (defaults to 1.0 if absent)

Parameters:

Name Type Description Default
parameters str

space-separated parameter values to configure the term.

required

discretize

discretize(start: float, end: float, resolution: int = 10, midpoints: bool = True) -> Discrete

Discretize the term.

Parameters:

Name Type Description Default
start float

start of the range

required
end float

end of the range

required
resolution int

number of points to discretize

10
midpoints bool

use midpoints method or include start and end.

True
related

is_monotonic

is_monotonic() -> bool

Return whether the term is monotonic.

Returns:

Type Description
bool

False.

membership abstractmethod

membership(x: Scalar) -> Scalar

Compute the membership function value of \(x\).

Parameters:

Name Type Description Default
x Scalar

scalar

required

Returns:

Type Description
Scalar

membership function value \(\mu(x)\).

parameters

parameters() -> str

Return the parameters of the term.

Returns:

Type Description
str

list of space-separated parameters of the term.

tsukamoto

tsukamoto(y: Scalar) -> Scalar

Compute the tsukamoto value of the monotonic term for activation degree \(y\).

Equation

\(g(y) = \{ z \in\mathbb{R} : \mu(z) = y \}\)

Warning

Raises RuntimeError because the term does not support Tsukamoto

Parameters:

Name Type Description Default
y Scalar

activation degree

required

Raises:

Type Description
RuntimeError

because the term does not support Tsukamoto

update_reference

update_reference(engine: Engine | None) -> None

Update the reference (if any) to the engine the term belongs to.

Parameters:

Name Type Description Default
engine Engine | None

engine to which the term belongs to.

required