-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
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
Add FuzzySet Class for Triangular Fuzzy Sets #11036
Conversation
wait I will fix 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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
fuzzy_logic/fuzzy_operations.py
Outdated
elif self.b < x < self.c: | ||
return (self.c - x) / (self.c - self.b) | ||
|
||
def union(self, other): |
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.
As there is no test file in this pull request nor any test function or class in the file fuzzy_logic/fuzzy_operations.py
, please provide doctest for the function union
Please provide return type hint for the function: union
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: other
fuzzy_logic/fuzzy_operations.py
Outdated
|
||
plt.plot(x, y, label=self.name) | ||
|
||
def __str__(self): |
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.
As there is no test file in this pull request nor any test function or class in the file fuzzy_logic/fuzzy_operations.py
, please provide doctest for the function __str__
Please provide return type hint for the function: __str__
. If the function does not return a value, please provide the type hint as: def function() -> None:
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.
Ok
for more information, see https://pre-commit.ci
Hey can you put a Hacktoberfest label into this pull request?? |
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
fuzzy_logic/fuzzy_operations.py
Outdated
self.right_boundary = right_boundary # Right boundary | ||
|
||
|
||
def membership(self, x): |
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.
As there is no test file in this pull request nor any test function or class in the file fuzzy_logic/fuzzy_operations.py
, please provide doctest for the function membership
Please provide return type hint for the function: membership
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide descriptive name for the parameter: x
Please provide type hint for the parameter: x
fuzzy_logic/fuzzy_operations.py
Outdated
elif self.b < x < self.c: | ||
return (self.c - x) / (self.c - self.b) | ||
|
||
def union(self, other): |
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.
As there is no test file in this pull request nor any test function or class in the file fuzzy_logic/fuzzy_operations.py
, please provide doctest for the function union
Please provide return type hint for the function: union
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: other
fuzzy_logic/fuzzy_operations.py
Outdated
(self.b + other.b) / 2, | ||
) | ||
|
||
def intersection(self, other): |
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.
As there is no test file in this pull request nor any test function or class in the file fuzzy_logic/fuzzy_operations.py
, please provide doctest for the function intersection
Please provide return type hint for the function: intersection
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: other
fuzzy_logic/fuzzy_operations.py
Outdated
(self.b + other.b) / 2, | ||
) | ||
|
||
def complement(self): |
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.
As there is no test file in this pull request nor any test function or class in the file fuzzy_logic/fuzzy_operations.py
, please provide doctest for the function complement
Please provide return type hint for the function: complement
. If the function does not return a value, please provide the type hint as: def function() -> None:
complement_name = f"¬{self.name}" | ||
return FuzzySet(complement_name, 1 - self.c, 1 - self.a, 1 - self.b) | ||
|
||
def plot(self): |
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.
As there is no test file in this pull request nor any test function or class in the file fuzzy_logic/fuzzy_operations.py
, please provide doctest for the function plot
Please provide return type hint for the function: plot
. If the function does not return a value, please provide the type hint as: def function() -> None:
fuzzy_logic/fuzzy_operations.py
Outdated
|
||
plt.plot(x, y, label=self.name) | ||
|
||
def __str__(self): |
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.
As there is no test file in this pull request nor any test function or class in the file fuzzy_logic/fuzzy_operations.py
, please provide doctest for the function __str__
Please provide return type hint for the function: __str__
. If the function does not return a value, please provide the type hint as: def function() -> None:
for more information, see https://pre-commit.ci
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
fuzzy_logic/fuzzy_operations.py
Outdated
self.peak = peak # Peak value | ||
self.right_boundary = right_boundary # Right boundary | ||
|
||
def membership(self, x): |
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.
Please provide return type hint for the function: membership
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide descriptive name for the parameter: x
Please provide type hint for the parameter: x
fuzzy_logic/fuzzy_operations.py
Outdated
elif self.b < x < self.c: | ||
return (self.c - x) / (self.c - self.b) | ||
|
||
def union(self, other): |
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.
Please provide return type hint for the function: union
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: other
fuzzy_logic/fuzzy_operations.py
Outdated
(self.b + other.b) / 2, | ||
) | ||
|
||
def intersection(self, other): |
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.
Please provide return type hint for the function: intersection
. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: other
fuzzy_logic/fuzzy_operations.py
Outdated
(self.b + other.b) / 2, | ||
) | ||
|
||
def complement(self): |
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.
Please provide return type hint for the function: complement
. If the function does not return a value, please provide the type hint as: def function() -> None:
complement_name = f"¬{self.name}" | ||
return FuzzySet(complement_name, 1 - self.c, 1 - self.a, 1 - self.b) | ||
|
||
def plot(self): |
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.
Please provide return type hint for the function: plot
. If the function does not return a value, please provide the type hint as: def function() -> None:
fuzzy_logic/fuzzy_operations.py
Outdated
|
||
plt.plot(x, y, label=self.name) | ||
|
||
def __str__(self): |
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.
Please provide return type hint for the function: __str__
. If the function does not return a value, please provide the type hint as: def function() -> None:
for more information, see https://pre-commit.ci
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
fuzzy_logic/fuzzy_operations.py
Outdated
# self.peak = peak # Peak value | ||
# self.right_boundary = right_boundary # Right boundary | ||
|
||
def membership(self, x: float) -> float: |
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.
Please provide descriptive name for the parameter: x
fuzzy_logic/fuzzy_operations.py
Outdated
elif self.peak < x < self.right_boundary: | ||
return (self.right_boundary - x) / (self.right_boundary - self.peak) | ||
|
||
def union(self, other) -> "FuzzySet": |
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.
Please provide type hint for the parameter: other
fuzzy_logic/fuzzy_operations.py
Outdated
(self.peak + other.peak) / 2, | ||
) | ||
|
||
def intersection(self, other) -> "FuzzySet": |
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.
Please provide type hint for the parameter: other
1 - self.peak, | ||
) | ||
|
||
def plot(self): |
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.
Please provide return type hint for the function: plot
. If the function does not return a value, please provide the type hint as: def function() -> None:
fuzzy_logic/fuzzy_operations.py
Outdated
|
||
plt.plot(x, y, label=self.name) | ||
|
||
def __str__(self): |
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.
Please provide return type hint for the function: __str__
. If the function does not return a value, please provide the type hint as: def function() -> None:
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
fuzzy_logic/fuzzy_operations.py
Outdated
# self.peak = peak # Peak value | ||
# self.right_boundary = right_boundary # Right boundary | ||
|
||
def membership(self, x: float) -> float: |
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.
Please provide descriptive name for the parameter: x
fuzzy_logic/fuzzy_operations.py
Outdated
elif self.peak < x < self.right_boundary: | ||
return (self.right_boundary - x) / (self.right_boundary - self.peak) | ||
|
||
def union(self, other) -> "FuzzySet": |
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.
Please provide type hint for the parameter: other
fuzzy_logic/fuzzy_operations.py
Outdated
(self.peak + other.peak) / 2, | ||
) | ||
|
||
def intersection(self, other) -> "FuzzySet": |
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.
Please provide type hint for the parameter: other
1 - self.peak, | ||
) | ||
|
||
def plot(self): |
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.
Please provide return type hint for the function: plot
. If the function does not return a value, please provide the type hint as: def function() -> None:
fuzzy_logic/fuzzy_operations.py
Outdated
|
||
plt.plot(x, y, label=self.name) | ||
|
||
def __str__(self): |
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.
Please provide return type hint for the function: __str__
. If the function does not return a value, please provide the type hint as: def function() -> None:
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
fuzzy_logic/fuzzy_operations.py
Outdated
# self.peak = peak # Peak value | ||
# self.right_boundary = right_boundary # Right boundary | ||
|
||
def membership(self, x: float) -> float: |
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.
Please provide descriptive name for the parameter: x
fuzzy_logic/fuzzy_operations.py
Outdated
elif self.peak < x < self.right_boundary: | ||
return (self.right_boundary - x) / (self.right_boundary - self.peak) | ||
|
||
def union(self, other) -> "FuzzySet": |
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.
Please provide type hint for the parameter: other
fuzzy_logic/fuzzy_operations.py
Outdated
(self.peak + other.peak) / 2, | ||
) | ||
|
||
def intersection(self, other) -> "FuzzySet": |
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.
Please provide type hint for the parameter: other
1 - self.peak, | ||
) | ||
|
||
def plot(self): |
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.
Please provide return type hint for the function: plot
. If the function does not return a value, please provide the type hint as: def function() -> None:
fuzzy_logic/fuzzy_operations.py
Outdated
|
||
plt.plot(x, y, label=self.name) | ||
|
||
def __str__(self): |
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.
Please provide return type hint for the function: __str__
. If the function does not return a value, please provide the type hint as: def function() -> None:
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
fuzzy_logic/fuzzy_operations.py
Outdated
peak: float | ||
right_boundary: float | ||
|
||
def membership(self, x: float) -> float: |
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.
Please provide descriptive name for the parameter: x
fuzzy_logic/fuzzy_operations.py
Outdated
elif self.peak < x < self.right_boundary: | ||
return (self.right_boundary - x) / (self.right_boundary - self.peak) | ||
|
||
def union(self, other) -> "FuzzySet": |
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.
Please provide type hint for the parameter: other
fuzzy_logic/fuzzy_operations.py
Outdated
(self.peak + other.peak) / 2, | ||
) | ||
|
||
def intersection(self, other) -> "FuzzySet": |
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.
Please provide type hint for the parameter: other
1 - self.peak, | ||
) | ||
|
||
def plot(self): |
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.
Please provide return type hint for the function: plot
. If the function does not return a value, please provide the type hint as: def function() -> None:
fuzzy_logic/fuzzy_operations.py
Outdated
|
||
plt.plot(x, y, label=self.name) | ||
|
||
def __str__(self): |
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.
Please provide return type hint for the function: __str__
. If the function does not return a value, please provide the type hint as: def function() -> None:
for more information, see https://pre-commit.ci
Please give me time to review the code without changing it. |
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
fuzzy_logic/fuzzy_operations.py
Outdated
peak: float | ||
right_boundary: float | ||
|
||
def membership(self, x: float) -> float: |
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.
Please provide descriptive name for the parameter: x
fuzzy_logic/fuzzy_operations.py
Outdated
elif self.peak < x < self.right_boundary: | ||
return (self.right_boundary - x) / (self.right_boundary - self.peak) | ||
|
||
def union(self, other) -> "FuzzySet": |
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.
Please provide type hint for the parameter: other
fuzzy_logic/fuzzy_operations.py
Outdated
(self.peak + other.peak) / 2, | ||
) | ||
|
||
def intersection(self, other) -> "FuzzySet": |
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.
Please provide type hint for the parameter: other
1 - self.peak, | ||
) | ||
|
||
def plot(self): |
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.
Please provide return type hint for the function: plot
. If the function does not return a value, please provide the type hint as: def function() -> None:
fuzzy_logic/fuzzy_operations.py
Outdated
|
||
plt.plot(x, y, label=self.name) | ||
|
||
def __str__(self): |
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.
Please provide return type hint for the function: __str__
. If the function does not return a value, please provide the type hint as: def function() -> None:
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
1 - self.peak, | ||
) | ||
|
||
def intersection(self, other) -> FuzzySet: |
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.
Please provide type hint for the parameter: other
(self.peak + other.peak) / 2, | ||
) | ||
|
||
def membership(self, x: float) -> float: |
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.
Please provide descriptive name for the parameter: x
msg = f"Invalid value {x} for fuzzy set {self}" | ||
raise ValueError(msg) | ||
|
||
def union(self, other) -> FuzzySet: |
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.
Please provide type hint for the parameter: other
(self.peak + other.peak) / 2, | ||
) | ||
|
||
def plot(self): |
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.
Please provide return type hint for the function: plot
. If the function does not return a value, please provide the type hint as: def function() -> None:
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
1 - self.peak, | ||
) | ||
|
||
def intersection(self, other) -> FuzzySet: |
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.
Please provide type hint for the parameter: other
(self.peak + other.peak) / 2, | ||
) | ||
|
||
def membership(self, x: float) -> float: |
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.
Please provide descriptive name for the parameter: x
msg = f"Invalid value {x} for fuzzy set {self}" | ||
raise ValueError(msg) | ||
|
||
def union(self, other) -> FuzzySet: |
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.
Please provide type hint for the parameter: other
(self.peak + other.peak) / 2, | ||
) | ||
|
||
def plot(self): |
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.
Please provide return type hint for the function: plot
. If the function does not return a value, please provide the type hint as: def function() -> None:
for more information, see https://pre-commit.ci
Hey, while you do that , can I fix few typo error , and make the code more descriptive, |
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.
Looks cool but I do not get all the details...
I moved some tests from fuzzy_logic/test_fuzzy_logic.py into doctests and removed that file. I did several updates to the main file to make it pass our tests. If it does so then I will approve and merge it. If you see missing tests or other errors, please open a new pull request with changes and @mention me on it.
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
same , my PR started failing, once I added that test_fuzzy_logic.py , i did so to remove the " required test " label, |
pytest not finding tests is often about not having an empty Please feel free to create pull requests to make this code what you want it to be. |
Also, Python
Enable the following notation: If you implemented |
* Added Opertation for triangular fuzzy sets * Added Sources * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix the bug , for which test were failing * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add type hints and improve parameter names * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add Test For fuzzy_operations.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix the bug in fuzzy_operations.py * Add test_fuzzy_logic.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix the bug in fuzzy_operations.py & deleted test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixed the typo error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Again done * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * corrected wrong intendation due to which test fail * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * bug fixed * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add test_fuzzy_logic * Modified fuzzy_operations.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed the bug, made a FuzzySet dataclass * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Replaced assertEqual of unittest to assert python * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * lets see * Changed test * orderd the import statements * Add docstring and dataclass the FuzzySet * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update fuzzy_operations.py * Delete fuzzy_logic/test_fuzzy_logic.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * https://en.wikipedia.org/wiki/Fuzzy_set --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
###hacktoberfest
Description:
This pull request introduces the FuzzySet class, designed to represent and manipulate triangular fuzzy sets widely used in fuzzy logic and control systems. The creation of this class was motivated by the need for a versatile tool for fuzzy logic operations.
Features:
Functionality:
Membership Calculation: The membership method calculates the membership value of an input x in the fuzzy set, handling cases where x is outside the fuzzy set boundaries.
Union and Intersection: The union and intersection methods allow users to calculate the union and intersection of fuzzy sets, respectively. These operations create new fuzzy sets based on the input fuzzy sets.
Complement (Negation): The complement method computes the complement (negation) of the fuzzy set, making it a valuable addition for fuzzy logic operations.
Plotting: The plot method generates a visual representation of the membership function for effective visualization and analysis.
Testing:
I have added a comprehensive test suite for the FuzzySet class to ensure its correctness and robustness. The tests cover various scenarios, including both valid and erroneous input values.
Example Usage:
The example usage section demonstrates how to create FuzzySet instances, perform operations, and visualize the membership functions of fuzzy sets. It provides practical insights into the class's capabilities.
I welcome your review and feedback, and I'm open to further improvements. Transparency is important, and I have designed this class based on existing knowledge and references from reputable sources.