fuzzy sets module

simpful.fuzzy_sets module

class simpful.fuzzy_sets.CrispSet(a, b, term)

Bases: simpful.fuzzy_sets.FuzzySet

Creates a new crisp set.

Parameters:
  • a – left extreme value of the set.

  • b – right extreme value of the set.

  • term – string representing the linguistic term to be associated to the crisp set.

set_params(a=None, b=None)

Changes parameters of the crisp set.

Parameters:
  • a – left extreme value of the set.

  • b – right extreme value of the set.

class simpful.fuzzy_sets.Crisp_MF(a, b)

Bases: simpful.fuzzy_sets.MF_object

Creates a crisp membership function.

Parameters:
  • a – left extreme value of the set.

  • b – right extreme value of the set.

class simpful.fuzzy_sets.DoubleGaussianFuzzySet(mu1, sigma1, mu2, sigma2, term)

Bases: simpful.fuzzy_sets.FuzzySet

Creates a new double Gaussian fuzzy set.

Parameters:
  • mu1 – mean of the first distribution.

  • sigma1 – standard deviation of the first distribution.

  • mu2 – mean of the second distribution.

  • sigma2 – standard deviation of the second distribution.

  • term – string representing the linguistic term to be associated to the fuzzy set.

set_params(mu1=None, sigma1=None, mu2=None, sigma2=None)

Changes parameters of the double Gaussian fuzzy set.

Parameters:
  • mu1 – mean of the first distribution.

  • sigma1 – standard deviation of the first distribution.

  • mu2 – mean of the second distribution.

  • sigma2 – standard deviation of the second distribution.

class simpful.fuzzy_sets.DoubleGaussian_MF(mu1, sigma1, mu2, sigma2)

Bases: simpful.fuzzy_sets.MF_object

Creates a double Gaussian membership function.

Parameters:
  • mu1 – mean of the first distribution.

  • sigma1 – standard deviation of the first distribution.

  • mu2 – mean of the second distribution.

  • sigma2 – standard deviation of the second distribution.

class simpful.fuzzy_sets.FuzzySet(points=None, function=None, term='', high_quality_interpolate=False, boundary_values=None, verbose=False)

Bases: object

Creates a new fuzzy set.

Parameters:
  • points – list of points to define a polygonal fuzzy sets. Each point is defined as a list of two coordinates in the universe of discourse/membership degree space.

  • function – function to define a non-polygonal fuzzy set. Supports pre-implemented membership functions Sigmoid_MF, InvSigmoid_MF, Gaussian_MF, InvGaussian_MF, DoubleGaussian_MF, Triangle_MF, Trapezoidal_MF or user-defined functions.

  • term – string representing the linguistic term to be associated to the fuzzy set.

  • high_quality_interpolate – True/False, toggles high quality interpolation for point-based fuzzy sets. Default value is set to False.

  • boundary_values – list of two membership values for point-based fuzzy sets. The first and second value are used to fill in values at the left-side and right-side of the fuzzy set, respectively. If None (default value), fuzzy sets will be considered as shouldered.

  • verbose – True/False, toggles verbose mode.

get_term()

Return the linguistic term associated to this fuzzy set.

get_value(v)

Return the membership value of v to this Fuzzy Set.

Parameters:

v – element of the universe of discourse.

Returns:

The membership value of v to this Fuzzy Set.

get_value_cut(v, cut)

Return the membership value of v to this Fuzzy Set, capped to the cut value.

Parameters:
  • v – element of the universe of discourse.

  • cut – alpha cut of the fuzzy set.

set_points(points)

Changes points of the point-based fuzzy set.

Parameters:

points – a list of points to define a polygonal fuzzy sets. Each point is defined as a list of two coordinates in the universe of discourse/membership degree space.

class simpful.fuzzy_sets.GaussianFuzzySet(mu, sigma, term)

Bases: simpful.fuzzy_sets.FuzzySet

Creates a new Gaussian fuzzy set.

Parameters:
  • mu – mean of the distribution.

  • sigma – standard deviation of the distribution.

  • term – string representing the linguistic term to be associated to the fuzzy set.

set_params(mu=None, sigma=None)

Changes parameters of the Gaussian fuzzy set.

Parameters:
  • mu – mean of the distribution.

  • sigma – standard deviation of the distribution.

class simpful.fuzzy_sets.Gaussian_MF(mu, sigma)

Bases: simpful.fuzzy_sets.MF_object

Creates a Gaussian membership function.

Parameters:
  • mu – mean of the distribution.

  • sigma – standard deviation of the distribution.

class simpful.fuzzy_sets.InvGaussianFuzzySet(mu, sigma, term)

Bases: simpful.fuzzy_sets.FuzzySet

Creates a new inversed Gaussian fuzzy set.

Parameters:
  • mu – mean of the distribution.

  • sigma – standard deviation of the distribution.

  • term – string representing the linguistic term to be associated to the fuzzy set.

set_params(mu=None, sigma=None)

Changes parameters of the inversed Gaussian fuzzy set.

Parameters:
  • mu – mean of the distribution.

  • sigma – standard deviation of the distribution.

class simpful.fuzzy_sets.InvGaussian_MF(mu, sigma)

Bases: simpful.fuzzy_sets.MF_object

Creates an inversed Gaussian membership function.

Parameters:
  • mu – mean of the distribution.

  • sigma – standard deviation of the distribution.

class simpful.fuzzy_sets.InvSigmoidFuzzySet(c, a, term)

Bases: simpful.fuzzy_sets.FuzzySet

Creates a new inversed sigmoidal fuzzy set.

Parameters:
  • c – universe of discourse coordinate of inflection point.

  • a – steepness of the curve.

  • term – string representing the linguistic term to be associated to the fuzzy set.

set_params(c=None, a=None)

Changes parameters of the inversed sigmoidal fuzzy set.

Parameters:
  • c – universe of discourse coordinate of inflection point.

  • a – steepness of the curve.

class simpful.fuzzy_sets.InvSigmoid_MF(c=0, a=1)

Bases: simpful.fuzzy_sets.MF_object

Creates an inversed sigmoid membership function.

Parameters:
  • c – universe of discourse coordinate of inflection point.

  • a – steepness of the curve.

class simpful.fuzzy_sets.SigmoidFuzzySet(c, a, term)

Bases: simpful.fuzzy_sets.FuzzySet

Creates a new sigmoidal fuzzy set.

Parameters:
  • c – universe of discourse coordinate of inflection point.

  • a – steepness of the curve.

  • term – string representing the linguistic term to be associated to the fuzzy set.

set_params(c=None, a=None)

Changes parameters of the sigmoidal fuzzy set.

Parameters:
  • c – universe of discourse coordinate of inflection point.

  • a – steepness of the curve.

class simpful.fuzzy_sets.Sigmoid_MF(c=0, a=1)

Bases: simpful.fuzzy_sets.MF_object

Creates a sigmoidal membership function.

Parameters:
  • c – universe of discourse coordinate of the inflection point.

  • a – steepness of the curve.

class simpful.fuzzy_sets.SingletonsSet(pairs, term)

Bases: simpful.fuzzy_sets.FuzzySet

Creates a set composed of singletons.

Parameters:
  • pairs – a list of pairs [x, y], where x is an element of the universe of discourse and y its membership degree.

  • term – string representing the linguistic term to be associated to the singletons set.

set_params(pairs=None)

Changes the pairs of the singletons set.

Parameters:

pairs – a list of pairs [x, y], where x is an element of the universe of discourse and y its membership degree.

class simpful.fuzzy_sets.Singletons_MF(pairs)

Bases: simpful.fuzzy_sets.MF_object

Creates a membership function composed of singletons.

Parameters:

pairs – a list of pairs [x, y], where x is an element of the universe of discourse and y its membership degree.

class simpful.fuzzy_sets.TrapezoidFuzzySet(a, b, c, d, term)

Bases: simpful.fuzzy_sets.FuzzySet

Creates a new trapezoidal fuzzy set.

Parameters:
  • a – universe of discourse coordinate of the leftmost vertex.

  • b – universe of discourse coordinate of the upper left vertex.

  • c – universe of discourse coordinate of the upper right vertex.

  • d – universe of discourse coordinate of the rightmost vertex.

  • term – string representing the linguistic term to be associated to the fuzzy set.

set_params(a=None, b=None, c=None, d=None)

Changes parameters of the trapezoidal fuzzy set.

Parameters:
  • a – universe of discourse coordinate of the leftmost vertex.

  • b – universe of discourse coordinate of the upper left vertex.

  • c – universe of discourse coordinate of the upper right vertex.

  • d – universe of discourse coordinate of the rightmost vertex.

class simpful.fuzzy_sets.Trapezoidal_MF(a=0, b=0.25, c=0.75, d=1)

Bases: simpful.fuzzy_sets.MF_object

Creates a normalized trapezoidal membership function. Requires a <= b <= c <= d.

Parameters:
  • a – universe of discourse coordinate of the leftmost vertex.

  • b – universe of discourse coordinate of the upper left vertex.

  • c – universe of discourse coordinate of the upper right vertex.

  • d – universe of discourse coordinate of the rightmost vertex.

class simpful.fuzzy_sets.TriangleFuzzySet(a, b, c, term)

Bases: simpful.fuzzy_sets.FuzzySet

Creates a new triangular fuzzy set.

Parameters:
  • a – universe of discourse coordinate of the leftmost vertex.

  • b – universe of discourse coordinate of the upper vertex.

  • c – universe of discourse coordinate of the rightmost vertex.

  • term – string representing the linguistic term to be associated to the fuzzy set.

set_params(a=None, b=None, c=None)

Changes parameters of the triangular fuzzy set.

Parameters:
  • a – universe of discourse coordinate of the leftmost vertex.

  • b – universe of discourse coordinate of the upper vertex.

  • c – universe of discourse coordinate of the rightmost vertex.

class simpful.fuzzy_sets.Triangular_MF(a=0, b=0.5, c=1)

Bases: simpful.fuzzy_sets.MF_object

Creates a normalized triangular membership function. Requires a <= b <= c and the semantics is the following:

1   |   .
    |  / \
    | /   \
0   |/     \
    ---------
     a  b  c
Parameters:
  • a – universe of discourse coordinate of the leftmost vertex.

  • b – universe of discourse coordinate of the upper vertex.

  • c – universe of discourse coordinate of the rightmost vertex.