mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-05-18 15:11:28 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
e778cb35b7
commit
abe9361792
@ -10,7 +10,7 @@ import numpy as np
|
|||||||
|
|
||||||
class FuzzySet:
|
class FuzzySet:
|
||||||
"""
|
"""
|
||||||
A class for representing and
|
A class for representing and
|
||||||
manipulating triangular fuzzy sets.
|
manipulating triangular fuzzy sets.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
@ -20,26 +20,26 @@ class FuzzySet:
|
|||||||
c (float): The right boundary of the fuzzy set.
|
c (float): The right boundary of the fuzzy set.
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
membership(x): Calculate the membership value
|
membership(x): Calculate the membership value
|
||||||
of an input 'x' in the fuzzy set.
|
of an input 'x' in the fuzzy set.
|
||||||
union(other): Calculate the union of this fuzzy set
|
union(other): Calculate the union of this fuzzy set
|
||||||
with another fuzzy set.
|
with another fuzzy set.
|
||||||
intersection(other): Calculate the intersection of this fuzzy set
|
intersection(other): Calculate the intersection of this fuzzy set
|
||||||
with another fuzzy set.
|
with another fuzzy set.
|
||||||
complement(): Calculate the complement (negation)
|
complement(): Calculate the complement (negation)
|
||||||
of this fuzzy set.
|
of this fuzzy set.
|
||||||
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, a, b, c):
|
||||||
"""
|
"""
|
||||||
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.
|
a (float): The left boundary of the fuzzy set.
|
||||||
b (float): The peak (central) value of
|
b (float): The peak (central) value of
|
||||||
the fuzzy set.
|
the fuzzy set.
|
||||||
c (float): The right boundary of the fuzzy set.
|
c (float): The right boundary of the fuzzy set.
|
||||||
"""
|
"""
|
||||||
@ -50,15 +50,15 @@ class FuzzySet:
|
|||||||
|
|
||||||
def membership(self, x):
|
def membership(self, x):
|
||||||
"""
|
"""
|
||||||
Calculate the membership value of
|
Calculate the membership value of
|
||||||
an input 'x' in the fuzzy set.
|
an input 'x' in the fuzzy set.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
x (float): The input value for
|
x (float): The input value for
|
||||||
which the membership is calculated.
|
which the membership is calculated.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: The membership value of 'x' in
|
float: The membership value of 'x' in
|
||||||
the fuzzy set.
|
the fuzzy set.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class FuzzySet:
|
|||||||
|
|
||||||
def union(self, other):
|
def union(self, other):
|
||||||
"""
|
"""
|
||||||
Calculate the union of this fuzzy set
|
Calculate the union of this fuzzy set
|
||||||
with another fuzzy set.
|
with another fuzzy set.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -79,7 +79,7 @@ class FuzzySet:
|
|||||||
to union with.
|
to union with.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
FuzzySet: A new fuzzy
|
FuzzySet: A new fuzzy
|
||||||
set representing the union.
|
set representing the union.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class FuzzySet:
|
|||||||
|
|
||||||
def intersection(self, other):
|
def intersection(self, other):
|
||||||
"""
|
"""
|
||||||
Calculate the intersection of this
|
Calculate the intersection of this
|
||||||
fuzzy set with another fuzzy set.
|
fuzzy set with another fuzzy set.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user