Python icon indicating copy to clipboard operation
Python copied to clipboard

Add Set-Like Operations to FuzzySet Class and Improved variable name

Open Shreya123714 opened this issue 2 years ago • 8 comments

###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

Shreya123714 avatar Oct 29 '23 14:10 Shreya123714

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

Shreya123714 avatar Oct 29 '23 15:10 Shreya123714

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

Shreya123714 avatar Oct 29 '23 15:10 Shreya123714

@cclauss thank you !!! can you please review it... let me know if there are any feedbacks or/and suggestions?

Shreya123714 avatar Oct 29 '23 16:10 Shreya123714

Please review this. 🙌🙏🙏

Shreya123714 avatar Oct 30 '23 04:10 Shreya123714

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.

cclauss avatar Oct 30 '23 08:10 cclauss

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.

sorry for that, i will correct it

Shreya123714 avatar Oct 30 '23 08:10 Shreya123714

sorry , i mistakenly resolve this conversetion related to , left_boundary <= peak <= right_boundary,

Shreya123714 avatar Oct 30 '23 09:10 Shreya123714

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

Let me think. it is confusing.

Shreya123714 avatar Oct 31 '23 12:10 Shreya123714