Add Set-Like Operations to FuzzySet Class and Improved variable name
###hacktoberfest
Description
This pull request extends the functionality of the FuzzySet class by introducing set-like operations (&, |, ~) and adding corresponding doctests. These enhancements make the FuzzySet class even more versatile for working with fuzzy sets in the context of fuzzy logic.
Changes Made:
- Added the '&' (intersection), '|' (union), and '~' (complement) operations to the FuzzySet class, enabling set-like operations for fuzzy sets.
- Implemented corresponding doctests for the new operations, ensuring their correctness and reliability.
Purpose:
The purpose of these changes is to enhance the FuzzySet class's capabilities and make it more powerful for fuzzy logic and control systems. The introduction of set operations is a valuable addition for those working with fuzzy sets and fuzzy logic.
Testing:
The new code changes come with extensive doctests that verify the correctness of the '&' (intersection), '|' (union), and '~' (complement) operations. These tests cover various scenarios to ensure robustness and reliability.
I invite your review and feedback on these changes. Feel free to suggest any improvements or modifications to make the FuzzySet class even better. Your input is highly valued, and I aim to contribute to a more comprehensive and effective tool for fuzzy logic operations.
@cclauss
Its been labeled invalid (I did something wrong 🫥, I am sorry!), do I close this request and make appropriate changes , commit and then open a new PR ?? sorry for this mistake @cclauss
Hi @cclauss , my pr has passed all checks , can you review it... and Please remove this "invalid" label , otherwise this pr will not get counted in Hacktoberfest.. please help
@cclauss thank you !!! can you please review it... let me know if there are any feedbacks or/and suggestions?
Please review this. 🙌🙏🙏
Error: fuzzy_logic/fuzzy_operations.py:181:32: F821 Undefined name an_element
Error: fuzzy_logic/fuzzy_operations.py:195:30: F821 Undefined name another_fuzzy_set
Error: fuzzy_logic/fuzzy_operations.py:196:37: F821 Undefined name another_fuzzy_set
Error: fuzzy_logic/fuzzy_operations.py:197:38: F821 Undefined name another_fuzzy_set
Error: fuzzy_logic/fuzzy_operations.py:198:26: F821 Undefined name another_fuzzy_set
Error: Process completed with exit code 1.
Error: fuzzy_logic/fuzzy_operations.py:181:32: F821 Undefined name
an_elementError: fuzzy_logic/fuzzy_operations.py:195:30: F821 Undefined nameanother_fuzzy_setError: fuzzy_logic/fuzzy_operations.py:196:37: F821 Undefined nameanother_fuzzy_setError: fuzzy_logic/fuzzy_operations.py:197:38: F821 Undefined nameanother_fuzzy_setError: fuzzy_logic/fuzzy_operations.py:198:26: F821 Undefined nameanother_fuzzy_setError: Process completed with exit code 1.
sorry for that, i will correct it
sorry , i mistakenly resolve this conversetion related to , left_boundary <= peak <= right_boundary,
Sorry, but lots of changes...
Traditionally dunder (double underscore) methods should appear at the top of the class with
.__str__(), not at the bottom.There should be one-- and preferably only one --obvious way to do it. -- https://peps.python.org/pep-0020
My sense is that we should simplify by either having these dunder methods or the original four but not both. Decide whether your audience would prefer a syntax like Python
setor a different one and then remove one group of methods.Python set Original four ~fuzzy_set fuzzy_set.complement() element in fuzzy_set -> bool fuzzy_set.membership(element) -> float fuzzy_set & other fuzzy_set.intersection(other) fuzzy_set | other fuzzy_set.union(other) Although Python sets do have
.union()and.intersection(). https://docs.python.org/3/library/stdtypes.html#frozenset.union
Let me think. it is confusing.