Add type hints and improve parameter names

This commit is contained in:
Shreya123714 2023-10-28 11:14:57 +05:30
parent e778cb35b7
commit c51022bc2e

View File

@ -31,22 +31,21 @@ class FuzzySet:
plot(): Plot the membership function of the fuzzy set. plot(): Plot the membership function of the fuzzy set.
""" """
def __init__(self, name, a, b, c): def __init__(self, name: str, left_boundary: float, peak: float, right_boundary: float) -> None:
""" """
Initializes a triangular fuzzy set Initializes a triangular fuzzy set with the given parameters.
with the given parameters.
Args: Args:
name (str): The name or label of the fuzzy set. name (str): The name or label of the fuzzy set.
a (float): The left boundary of the fuzzy set. left_boundary (float): The left boundary of the fuzzy set.
b (float): The peak (central) value of peak (float): The peak (central) value of the fuzzy set.
the fuzzy set. right_boundary (float): The right boundary of the fuzzy set.
c (float): The right boundary of the fuzzy set.
""" """
self.name = name # Fuzzy set name self.name = name # Fuzzy set name
self.a = a # Left boundary self.left_boundary = left_boundary # Left boundary
self.b = b # Peak value self.peak = peak # Peak value
self.c = c # Right boundary self.right_boundary = right_boundary # Right boundary
def membership(self, x): def membership(self, x):
""" """