Skip to content

Commit a39e0dd

Browse files
authored
Update fuzzy_operations.py
1 parent 6fd80a3 commit a39e0dd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fuzzy_logic/fuzzy_operations.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import matplotlib.pyplot as plt
66
import numpy as np
7-
87
@dataclass
98
class FuzzySet:
109
"""
@@ -16,7 +15,7 @@ class FuzzySet:
1615
right_boundary: float
1716

1817
def __str__(self) -> str:
19-
return f"{self.name}: [{self.left_boundary}, {self.peak}, {self.right_boundary}]"
18+
return f"{self.name}:[{self.left_boundary}, {self.peak}, {self.right_boundary}]"
2019

2120
def complement(self) -> FuzzySet:
2221
return FuzzySet(
@@ -40,8 +39,7 @@ def membership(self, x: float) -> float:
4039
elif self.left_boundary < x <= self.peak:
4140
return (x - self.left_boundary) / (self.peak - self.left_boundary)
4241
elif self.peak < x < self.right_boundary:
43-
return (self.right_boundary - x) / (self.right_boundary - self.peak)
44-
42+
return (self.right_boundary - x) / (self.right_boundary - self.peak)
4543
msg = f"Invalid value {x} for fuzzy set {self}"
4644
raise ValueError(msg)
4745

0 commit comments

Comments
 (0)