File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -38,20 +38,20 @@ def __init__(
38
38
self .peak = peak # Peak value
39
39
self .right_boundary = right_boundary # Right boundary
40
40
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 :
47
42
"""
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
+ """
48
47
if x <= self .left_boundary or x >= self .right_boundary :
49
- return 0
48
+ return 0.0
50
49
elif self .left_boundary < x <= self .peak :
51
50
return (x - self .left_boundary ) / (self .peak - self .left_boundary )
52
51
elif self .peak < x < self .right_boundary :
53
52
return (self .right_boundary - x ) / (self .right_boundary - self .peak )
54
53
54
+
55
55
def union (self , other ) -> "FuzzySet" :
56
56
"""
57
57
Calculate the union of this fuzzy set with another fuzzy set.
You can’t perform that action at this time.
0 commit comments