ex_fuzzy.rules.compute_antecedents_memberships#

ex_fuzzy.rules.compute_antecedents_memberships(antecedents, x)[source]#

Compute membership degrees for input values across all fuzzy variables.

This function calculates the membership degrees of input values for each linguistic variable in the antecedents. It returns a structured representation that can be used for efficient rule evaluation and inference.

Parameters:
  • antecedents (list[fs.fuzzyVariable]) – List of fuzzy variables representing the antecedents (input variables) of the fuzzy system

  • x (np.array) – Input vector with values for each antecedent variable. Shape should be (n_samples, n_variables) or (n_variables,) for single sample

Returns:

List containing membership dictionaries for each antecedent variable.

Each dictionary maps linguistic term indices to their membership degrees.

Return type:

list[dict]

Example

>>> # For 2 variables with 3 linguistic terms each
>>> antecedents = [temp_var, pressure_var]
>>> x = np.array([25.0, 101.3])  # temperature=25°C, pressure=101.3kPa
>>> memberships = compute_antecedents_memberships(antecedents, x)
>>> # memberships[0] contains temperature memberships: {0: 0.2, 1: 0.8, 2: 0.0}
>>> # memberships[1] contains pressure memberships: {0: 0.0, 1: 0.6, 2: 0.4}

Note

This function is typically used internally during rule evaluation but can be useful for debugging membership degree calculations or analyzing input fuzzification.