File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33from dataclasses import dataclass
4-
54import matplotlib .pyplot as plt
65import numpy as np
6+
77@dataclass
88class FuzzySet :
99 """
@@ -15,7 +15,7 @@ class FuzzySet:
1515 right_boundary : float
1616
1717 def __str__ (self ) -> str :
18- 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 } ]"
1919
2020 def complement (self ) -> FuzzySet :
2121 return FuzzySet (
@@ -39,7 +39,8 @@ def membership(self, x: float) -> float:
3939 elif self .left_boundary < x <= self .peak :
4040 return (x - self .left_boundary ) / (self .peak - self .left_boundary )
4141 elif self .peak < x < self .right_boundary :
42- return (self .right_boundary - x ) / (self .right_boundary - self .peak )
42+ return (self .right_boundary - x ) / (self .right_boundary - self .peak )
43+
4344 msg = f"Invalid value { x } for fuzzy set { self } "
4445 raise ValueError (msg )
4546
You can’t perform that action at this time.
0 commit comments