Skip to content

Commit 2dd8521

Browse files
committed
Add docstring and dataclass the FuzzySet
1 parent 2b1cef8 commit 2dd8521

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

fuzzy_logic/fuzzy_operations.py

+3-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import numpy as np
2+
23
import matplotlib.pyplot as plt
3-
from dataclasses import dataclass
44

5+
from dataclasses import dataclass
56
"""
67
By @Shreya123714
78
@@ -53,22 +54,6 @@ class FuzzySet:
5354
peak: float
5455
right_boundary: float
5556

56-
# def __init__(
57-
# self, name: str, left_boundary: float, peak: float, right_boundary: float
58-
# ) -> None:
59-
"""
60-
Initializes a triangular fuzzy set with the given parameters.
61-
Args:
62-
name (str): The name or label of the fuzzy set.
63-
left_boundary (float): The left boundary of the fuzzy set.
64-
peak (float): The peak (central) value of the fuzzy set.
65-
right_boundary (float): The right boundary of the fuzzy set.
66-
"""
67-
# self.name = name # Fuzzy set name
68-
# self.left_boundary = left_boundary # Left boundary
69-
# self.peak = peak # Peak value
70-
# self.right_boundary = right_boundary # Right boundary
71-
7257
def membership(self, x: float) -> float:
7358
"""
7459
Calculate the membership value of an input 'x' in the fuzzy set.
@@ -170,6 +155,7 @@ def __str__(self):
170155
plt.show()
171156
else:
172157
import unittest
158+
173159
from test_fuzzy_logic import TestFuzzySet
174160

175161
suite = unittest.TestLoader().loadTestsFromTestCase(TestFuzzySet)

0 commit comments

Comments
 (0)