Fuzzy Sets Functions
This is a the source file that contains the class of GT2 fuzzy set and its most direct applications, like computing the FM function, etc.
- class ex_fuzzy.fuzzy_sets.FS(name: str, membership_parameters: list[float], domain: list[float])[source]
Bases:
object
Class that defines the most basic fuzzy sets (also known as Type 1 fuzzy sets or Zadeh sets).
- class ex_fuzzy.fuzzy_sets.GT2(name: str, secondary_memberships: dict[float, FS], domain: list[float], significant_decimals: int, alpha_cuts: list[float] = [0.2, 0.4, 0.5, 0.7, 0.9, 1.0], unit_resolution: float = 0.2)[source]
Bases:
FS
Class to define a gt2 fuzzy set.
- alpha_reduction(x) array [source]
Computes the type reduction to reduce the alpha cuts to one value.
- Parameters:
x – array with the values of the inputs.
- Returns:
array with the memberships of the consequents for each sample.
- class ex_fuzzy.fuzzy_sets.IVFS(name: str, secondMF_lower: list[float], secondMF_upper: list[float], domain: list[float], lower_height=1.0)[source]
Bases:
FS
Class to define a iv fuzzy set.
- class ex_fuzzy.fuzzy_sets.categoricalFS(name: str, category)[source]
Bases:
FS
- class ex_fuzzy.fuzzy_sets.categoricalIVFS(name: str, category)[source]
Bases:
IVFS
Class to define a iv fuzzy set with categorical membership.
- class ex_fuzzy.fuzzy_sets.fuzzyVariable(name: str, fuzzy_sets: list[FS], units: str = None)[source]
Bases:
object
Class to implement a fuzzy Variable. Contains a series of fuzzy sets and computes the memberships to all of them.
- append(fs: FS) None [source]
Appends a fuzzy set to the fuzzy variable.
- Parameters:
fs – FS. Fuzzy set to append.
- compute_memberships(x: array) list [source]
Computes the membership to each of the FS in the fuzzy variables.
- Parameters:
x – numeric value or array. Computes the membership to each of the FS in the fuzzy variables.
- Returns:
list of floats. Membership to each of the FS in the fuzzy variables.
- fuzzy_type() FUZZY_SETS [source]
Returns the fuzzy type of the domain
- Returns:
the type of the fuzzy set present in the fuzzy variable.
- class ex_fuzzy.fuzzy_sets.gaussianFS(name: str, membership_parameters: list[float], domain: list[float])[source]
Bases:
FS
Class to define a gaussian fuzzy set.
- class ex_fuzzy.fuzzy_sets.gaussianIVFS(name: str, secondMF_lower: list[float], secondMF_upper: list[float], domain: list[float], lower_height=1.0)[source]
Bases:
IVFS
Class to define a iv fuzzy set with gaussian membership.
- ex_fuzzy.fuzzy_sets.trapezoidal_membership(x: array, params: list[float], epsilon=0.0001) array [source]
Trapezoidal membership functions.
- Parameters:
x – input values in the fuzzy set referencial domain.
params – four numbers that comprises the start and end of the trapezoid.
epsilon – small float number for numerical stability. Adjust accordingly only if there are NaN issues.