Update gaussian_fuzzyset.py

corrected the np.float64(1.0) error
This commit is contained in:
Shreya 2024-10-30 17:21:35 +05:30 committed by GitHub
parent a05f867d5b
commit 03ae118193
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,8 +52,10 @@ class GaussianFuzzySet:
>>> GaussianFuzzySet("Medium", 0, 1).membership(1)
0.6065306597126334
"""
membership_value = np.exp(-0.5 * ((x - self.mean) / self.std_dev) ** 2)
return 1 - membership_value if self.is_complement else membership_value
# Directly return for non-complement or return 1 - membership for complement
return membership_value if not self.is_complement else 1 - membership_value
def complement(self) -> GaussianFuzzySet:
"""