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: array, w: array) array[source]

Computes the ponderated centroid with normalized weighting.

Parameters:
  • z – Vector of the referencial values.

  • w – Vector of the fuzzy memberships.

Returns:

The ponderated sum.

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

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

Parameters:
  • z – Vector of the referencial values.

  • memberships – vector of the fuzzy memberships.

Returns:

The centroid.

ex_fuzzy.centroid.compute_centroid_t2_l(z: array, memberships: array) float[source]

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

Parameters:
  • z – Vector of the referencial values.

  • memberships – vector of the fuzzy memberships.

Returns:

The centroid.

ex_fuzzy.centroid.compute_centroid_t2_r(z: array, memberships: array) float[source]

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

Parameters:
  • z – Vector of the referencial values.

  • memberships – vector of the fuzzy memberships.

Returns:

The lowest membership of the centroid.

ex_fuzzy.centroid.consequent_centroid(antecedent_memberships: array, centroids: array) array[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 – M x 2 matrix. M rules and iv dimension (2). Vector of memberships.

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

Returns:

The centroid.

ex_fuzzy.centroid.consequent_centroid_l(antecedent_memberships: array, centroids_l: array) float[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 – 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.

ex_fuzzy.centroid.consequent_centroid_r(antecedent_memberships: array, centroids_r: array) float[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 – 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.