ex_fuzzy.fuzzy_sets.gaussianFS#

class ex_fuzzy.fuzzy_sets.gaussianFS(name, membership_parameters, domain)[source]#

Bases: FS

Gaussian Type-1 Fuzzy Set Implementation.

This class implements a Gaussian fuzzy set with bell-shaped membership function. Gaussian fuzzy sets are characterized by their mean and standard deviation, providing smooth membership transitions ideal for continuous variables.

membership_parameters#

[mean, standard_deviation] defining the Gaussian curve

Type:

list

name#

Human-readable name for the fuzzy set

Type:

str

universe_size#

Size of the universe of discourse

Type:

int

Example

>>> params = [5.0, 1.5]  # mean=5, std=1.5
>>> gauss_fs = gaussianFS(params, "Medium", 10)
>>> membership = gauss_fs.membership(np.array([4.0, 5.0, 6.0]))
>>> print(membership)  # [0.606, 1.0, 0.606]

Note

The membership function follows the formula: μ(x) = exp(-0.5 * ((x - mean) / std)^2)

__init__(name, membership_parameters, domain)#

Initialize a Type-1 fuzzy set.

Parameters:
  • name (str) – Linguistic name for the fuzzy set

  • membership_parameters (list[float]) – Four parameters [a, b, c, d] defining the trapezoidal membership function where: - a: left foot (membership starts rising from 0) - b: left shoulder (membership reaches 1.0) - c: right shoulder (membership starts falling from 1.0) - d: right foot (membership reaches 0)

  • domain (list[float]) – Two-element list [min, max] defining the universe of discourse for this fuzzy set

Example

>>> fs = FS("medium", [2, 3, 7, 8], [0, 10])
>>> # Creates a trapezoidal set: rises from 2-3, flat 3-7, falls 7-8

Methods

__init__(name, membership_parameters, domain)

Initialize a Type-1 fuzzy set.

membership(input)

Computes the Gaussian membership values for input points.

shape()

Returns the shape of the fuzzy set.

type()

Returns the type of the fuzzy set.

membership(input)[source]#

Computes the Gaussian membership values for input points.

The membership function implements the Gaussian curve formula using the mean and standard deviation parameters.

Parameters:

input (np.array) – Input values in the fuzzy set domain

Returns:

Membership values in range [0, 1]

Return type:

np.array

Example

>>> gauss_fs = gaussianFS([0, 1], "Zero", 5)
>>> values = gauss_fs.membership(np.array([-1, 0, 1]))
>>> print(values)  # [0.606, 1.0, 0.606]
type()[source]#

Returns the type of the fuzzy set.

Returns:

Always returns FUZZY_SETS.t1 for Type-1 fuzzy sets

Return type:

FUZZY_SETS

shape()[source]#

Returns the shape of the fuzzy set.

Returns:

Always returns ‘gaussian’

Return type:

str