Skip to content

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

Closed
wants to merge 0 commits into from
Closed

Conversation

Shreya123714
Copy link
Contributor

@Shreya123714 Shreya123714 commented Oct 29, 2023

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

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 29, 2023
@cclauss cclauss reopened this Oct 29, 2023
@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files tests are failing Do not merge until tests pass labels Oct 29, 2023
@Shreya123714
Copy link
Contributor Author

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

@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Oct 29, 2023
@Shreya123714
Copy link
Contributor Author

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 cclauss removed the invalid label Oct 29, 2023
@Shreya123714
Copy link
Contributor Author

Shreya123714 commented Oct 29, 2023

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

@cclauss cclauss self-assigned this Oct 29, 2023
@Shreya123714
Copy link
Contributor Author

Please review this. 🙌🙏🙏

Copy link
Member

@cclauss cclauss left a 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

@algorithms-keeper algorithms-keeper bot added awaiting changes A maintainer has requested changes to this PR awaiting reviews This PR is ready to be reviewed and removed awaiting reviews This PR is ready to be reviewed awaiting changes A maintainer has requested changes to this PR labels Oct 30, 2023
@TheAlgorithms TheAlgorithms deleted a comment from algorithms-keeper bot Oct 30, 2023
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 30, 2023
@cclauss
Copy link
Member

cclauss commented Oct 30, 2023

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.

@Shreya123714
Copy link
Contributor Author

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

@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Oct 30, 2023
@Shreya123714 Shreya123714 requested a review from cclauss October 30, 2023 09:18
@Shreya123714
Copy link
Contributor Author

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

@Shreya123714
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants