ex_fuzzy.persistence.load_fuzzy_variables#
- ex_fuzzy.persistence.load_fuzzy_variables(fuzzy_variables_printed)[source]#
Load fuzzy variables from a text string representation.
This function parses a text-based representation of fuzzy variables and constructs a list of fuzzyVariable objects with their associated fuzzy sets and membership functions.
- Parameters:
fuzzy_variables_printed (str) – Text representation of fuzzy variables following the ex-fuzzy format. Should contain variable definitions starting with ‘$$$’ (for fuzzy variables) or ‘$Categorical’ (for categorical variables), followed by fuzzy set definitions with membership function parameters.
- Returns:
- List of fuzzyVariable objects containing all parsed linguistic variables
with their fuzzy sets and membership functions properly configured.
- Return type:
- Raises:
ValueError – If the text format is invalid or contains unrecognized elements
TypeError – If membership function parameters cannot be converted to proper types
Example
>>> fvars_text = '''$$$ Linguistic variable: temperature ... low;0.0,50.0;trap;0.0,0.0,20.0,30.0 ... high;0.0,50.0;trap;25.0,35.0,50.0,50.0''' >>> fuzzy_vars = load_fuzzy_variables(fvars_text)
Note
The text format supports: - Type-1 and Type-2 fuzzy sets (trapezoidal and gaussian) - Categorical variables with different data types - Variable units specification - Multiple membership function types per variable