-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
Add Set-Like Operations to FuzzySet Class and Improved variable name #11080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 ?? |
Hi @cclauss , my pr has passed all checks , can you review it... |
@cclauss thank you !!! |
Please review this. 🙌🙏🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 Pythonset
or 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
Error: fuzzy_logic/fuzzy_operations.py:181:32: F821 Undefined name |
sorry for that, i will correct it |
sorry , i mistakenly resolve this conversetion related to , left_boundary <= peak <= right_boundary, |
Let me think. it is confusing. |
###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:
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