fuzz.memb_funcs.Constant
- class fuzz.memb_funcs.Constant(min_v: float, max_v: float)[source]
Bases:
fuzz.memb_funcs.MembershipFunctionConstant function. Returns the initialization value
- __init__(min_v: float, max_v: float) None
Methods
__init__(min_v, max_v)area([activation, granularity])Numerical integration to calculate area
describe()describe is an function-optimized iterator, from min_v to max_v returning a tuple of ndarrays as X and Y values.
naive_describe(activation, granularity)same as describe, but not optmize.
naive_integration(activation, granularity)naive linear integration traversing the entire function.
optimal_integration(activation)Optimal integration strategy.
- area(activation=1.0, granularity=0.01)
Numerical integration to calculate area
- Parameters
granularity ([type]) – [description]
- Raises
NotImplementedError – [description]
- describe()[source]
describe is an function-optimized iterator, from min_v to max_v returning a tuple of ndarrays as X and Y values. Useful for plotting a line graph and visualizing the membership function shape
- Raises
NotImplementedError – means the membership function is missing the describe method
- Returns
a tuple of X-Y value arrays
- Return type
Tuple[np.ndarray, np.ndarray]
- naive_describe(activation: float, granularity: float) Tuple[numpy.ndarray, numpy.ndarray]
same as describe, but not optmize. Draws an iterator with linear values between min_v and max_v and a certain granularity.
- Parameters
activation (float) – max y-value for any x-value
granularity (float) – defines the linear iteration sample size
- Returns
a tuple of X-Y value arrays.
- Return type
Tuple[np.ndarray, np.ndarray]
- naive_integration(activation: float, granularity: float) List[Tuple[float, float, numpy.ndarray]]
naive linear integration traversing the entire function.
- Parameters
granularity (float) – sample size to numerical integration approximation
- Returns
List of Tuple object containing (a, b, f(x)) for numerical integration
- Return type
List[Tuple[float, float, np.ndarray]]