T2 Centroid compute#

This is the source file that contains functions to compute centroids for the case of IV fuzzy sets, which are commonly used when using the IV-T2 fuzzy sets.

ex_fuzzy.centroid.center_of_masses(z, w)[source]#

Computes the ponderated centroid with normalized weighting.

Parameters:
  • z (array) – Vector of the referencial values.

  • w (array) – Vector of the fuzzy memberships.

Returns:

The ponderated sum.

Return type:

array

ex_fuzzy.centroid.compute_centroid_t2_l(z, memberships)[source]#

Computes the Karnik and Mendel algorithm to find the centroid of an IV fuzzy set.

Parameters:
  • z (array) – Vector of the referencial values.

  • memberships (array) – vector of the fuzzy memberships.

Returns:

The centroid.

Return type:

float

ex_fuzzy.centroid.compute_centroid_t2_r(z, memberships)[source]#

Computes the Karnik and Mendel algorithm to find the right component of a centroid of an IV fuzzy set.

Parameters:
  • z (array) – Vector of the referencial values.

  • memberships (array) – vector of the fuzzy memberships.

Returns:

The lowest membership of the centroid.

Return type:

float

ex_fuzzy.centroid.consequent_centroid_r(antecedent_memberships, centroids_r)[source]#

Computes the Karnik and Mendel algorithm to find the right component of a centroid of an IV fuzzy set using the centroids of the consequents and the antecedents memeberships.

Parameters:
  • antecedent_memberships (array) – M x 2 matrix. M rules and iv dimension (2). Vector of memberships.

  • centroids_r (array) – M sized vector. Contains the referencial values.

Returns:

the IV centroid.

Return type:

float

ex_fuzzy.centroid.consequent_centroid_l(antecedent_memberships, centroids_l)[source]#

Computes the Karnik and Mendel algorithm to find the left component of a centroid of an IV fuzzy set using the centroids of the consequents and the antecedent memberships.

Parameters:
  • antecedent_memberships (array) – M x 2 matrix. M rules and iv dimension (2). Vector of memberships.

  • centroids_r – M sized vector. Contains the referencial values.

Returns:

the IV centroid.

Return type:

float

ex_fuzzy.centroid.compute_centroid_iv(z, memberships)[source]#

Computes Karnik and Mendel algorithm to find the centroid of a iv fuzzy set.

Parameters:
  • z (array) – Vector of the referencial values.

  • memberships (array) – vector of the fuzzy memberships.

Returns:

The centroid.

Return type:

array

ex_fuzzy.centroid.consequent_centroid(antecedent_memberships, centroids)[source]#

Computes Karnik and Mendel algorithm to find the centroid of a consequent iv fuzzy set given the centroids of the consequents and the antecedents memberships.

Parameters:
  • antecedent_memberships (array) – M x 2 matrix. M rules and iv dimension (2). Vector of memberships.

  • centroids (array) – M x 2 matrix. M rules and iv dimension (2). Vector of centroids.

Returns:

The centroid.

Return type:

array