@@ -27,8 +27,10 @@ class GaussianFuzzySet:
27
27
is_complement: Indicates whether this is the complement
28
28
of the original fuzzy set.
29
29
Methods:
30
- membership(x): Calculate the membership value of an input 'x' in the fuzzy set.
31
- complement(): Create a new GaussianFuzzySet instance representing the complement.
30
+ membership(member): Calculate the membership value of
31
+ an input 'member'in the fuzzy set.
32
+ complement(): Create a new GaussianFuzzySet instance representing
33
+ the complement.
32
34
plot(): Plot the membership function of the fuzzy set.
33
35
34
36
>>> fuzzy_set = GaussianFuzzySet("Medium Temperature", mean=25, std_dev=5)
@@ -45,9 +47,9 @@ class GaussianFuzzySet:
45
47
std_dev : float
46
48
is_complement : bool = False # This flag indicates if it's the complement set
47
49
48
- def membership (self , x : float ) -> float :
50
+ def membership (self , member : float ) -> float :
49
51
"""
50
- Calculate the membership value of an input 'x ' in the Gaussian fuzzy set.
52
+ Calculate the membership value of an input 'member ' in the Gaussian fuzzy set.
51
53
If it's a complement set, returns 1 - the Gaussian membership.
52
54
53
55
>>> GaussianFuzzySet("Medium", 0, 1).membership(0)
@@ -56,7 +58,7 @@ def membership(self, x: float) -> float:
56
58
0.6065306597126334
57
59
"""
58
60
59
- membership_value = np .exp (- 0.5 * ((x - self .mean ) / self .std_dev ) ** 2 )
61
+ membership_value = np .exp (- 0.5 * ((member - self .mean ) / self .std_dev ) ** 2 )
60
62
# Directly return for non-complement or return 1 - membership for complement
61
63
return membership_value if not self .is_complement else 1 - membership_value
62
64
@@ -74,7 +76,7 @@ def complement(self) -> GaussianFuzzySet:
74
76
is_complement = not self .is_complement ,
75
77
)
76
78
77
- def plot (self ):
79
+ def plot (self ) -> None :
78
80
"""
79
81
Plot the membership function of the Gaussian fuzzy set.
80
82
"""
0 commit comments