Calculate the intersection of this fuzzy set with another fuzzy set. Args: other: Another fuzzy set to intersect with. Returns: A new fuzzy set representing the intersection. >>> FuzzySet("a", 0.1, 0.2, 0.3).intersection(FuzzySet("b",
(self, other)
| 91 | ) |
| 92 | |
| 93 | def intersection(self, other) -> FuzzySet: |
| 94 | """ |
| 95 | Calculate the intersection of this fuzzy set |
| 96 | with another fuzzy set. |
| 97 | Args: |
| 98 | other: Another fuzzy set to intersect with. |
| 99 | Returns: |
| 100 | A new fuzzy set representing the intersection. |
| 101 | |
| 102 | >>> FuzzySet("a", 0.1, 0.2, 0.3).intersection(FuzzySet("b", 0.4, 0.5, 0.6)) |
| 103 | FuzzySet(name='a ∩ b', left_boundary=0.4, peak=0.3, right_boundary=0.35) |
| 104 | """ |
| 105 | return FuzzySet( |
| 106 | f"{self.name} ∩ {other.name}", |
| 107 | max(self.left_boundary, other.left_boundary), |
| 108 | min(self.right_boundary, other.right_boundary), |
| 109 | (self.peak + other.peak) / 2, |
| 110 | ) |
| 111 | |
| 112 | def membership(self, x: float) -> float: |
| 113 | """ |
no test coverage detected