Skip to content

Commit 14410df

Browse files
committed
bug fixed
1 parent 8a01993 commit 14410df

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fuzzy_logic/fuzzy_operations.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ def __init__(
3838
self.peak = peak # Peak value
3939
self.right_boundary = right_boundary # Right boundary
4040

41-
def membership(self, x) -> float:
42-
"""
43-
Calculate the membership value of an
44-
input 'x' in the fuzzy set.
45-
Returns:
46-
float: The membership value of 'x' in the fuzzy set.
41+
def membership(self, x: float) -> float:
4742
"""
43+
Calculate the membership value of an input 'x' in the fuzzy set.
44+
Returns:
45+
float: The membership value of 'x' in the fuzzy set.
46+
"""
4847
if x <= self.left_boundary or x >= self.right_boundary:
49-
return 0
48+
return 0.0
5049
elif self.left_boundary < x <= self.peak:
5150
return (x - self.left_boundary) / (self.peak - self.left_boundary)
5251
elif self.peak < x < self.right_boundary:
5352
return (self.right_boundary - x) / (self.right_boundary - self.peak)
5453

54+
5555
def union(self, other) -> "FuzzySet":
5656
"""
5757
Calculate the union of this fuzzy set with another fuzzy set.

0 commit comments

Comments
 (0)