fuzz.memb_funcs.Linear

class fuzz.memb_funcs.Linear(y_eq_zero: float, y_eq_one: float)[source]

Bases: fuzz.memb_funcs.MembershipFunction

Linear function

__init__(y_eq_zero: float, y_eq_one: float) None[source]

Methods

__init__(y_eq_zero, y_eq_one)

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]]

optimal_integration(activation) List[Tuple[float, float, numpy.ndarray]][source]

Optimal integration strategy. Defined at subclass