Module: defuzzify

skfuzzy.defuzzify subpackage, containing various defuzzification algorithms.

skfuzzy.defuzzify.arglcut(ms, lambdacut) Determines the subset of indices mi of the elements in an N-point resultant fuzzy membership sequence ms that have a grade of membership >= lambdacut.
skfuzzy.defuzzify.centroid(x, mfx) Defuzzification using centroid (center of gravity) method.
skfuzzy.defuzzify.dcentroid(x, mfx, x0) Defuzzification using a differential centroidal method about x0.
skfuzzy.defuzzify.defuzz(x, mfx, mode) Defuzzification of a membership function, returning a defuzzified value of the function at x, using various defuzzification methods.
skfuzzy.defuzzify.lambda_cut(ms, lcut) The crisp (binary) lambda-cut set of the membership sequence ms with membership >= lcut.
skfuzzy.defuzzify.lambda_cut_boundaries(x, ...) Find exact boundaries where mfx crosses lambdacut using interpolation.
skfuzzy.defuzzify.lambda_cut_series(x, mfx, n) Determine a series of lambda-cuts in a sweep from 0+ to 1.0 in n steps.

arglcut

skfuzzy.defuzzify.arglcut(ms, lambdacut)[source]

Determines the subset of indices mi of the elements in an N-point resultant fuzzy membership sequence ms that have a grade of membership >= lambdacut.

Parameters:

ms : 1d array

Fuzzy membership sequence.

lambdacut : float

Value used for lambda cutting.

Returns:

lidx : 1d array

Indices corresponding to the lambda-cut subset of ms.

Notes

This is a convenience function for np.nonzero(lambdacut <= ms) and only half of the indexing operation that can be more concisely accomplished via:

ms[lambdacut <= ms]

centroid

skfuzzy.defuzzify.centroid(x, mfx)[source]

Defuzzification using centroid (center of gravity) method.

Parameters:

x : 1d array, length M

Independent variable

mfx : 1d array, length M

Fuzzy membership function

Returns:

u : 1d array, length M

Defuzzified result

dcentroid

skfuzzy.defuzzify.dcentroid(x, mfx, x0)[source]

Defuzzification using a differential centroidal method about x0.

Parameters:

x : 1d array or iterable

Independent variable.

mfx : 1d array or iterable

Fuzzy membership function.

x0 : float

Central value to calculate differential centroid about.

Returns:

u : 1d array

Defuzzified result.

defuzz

skfuzzy.defuzzify.defuzz(x, mfx, mode)[source]

Defuzzification of a membership function, returning a defuzzified value of the function at x, using various defuzzification methods.

Parameters:

x : 1d array or iterable, length N

Independent variable.

mfx : 1d array of iterable, length N

Fuzzy membership function.

mode : string

Controls which defuzzification method will be used. * ‘centroid’: Centroid of area * ‘bisector’: bisector of area * ‘mom’ : mean of maximum * ‘som’ : min of maximum * ‘lom’ : max of maximum

Returns:

u : float or int

Defuzzified result.

lambda_cut

skfuzzy.defuzzify.lambda_cut(ms, lcut)[source]

The crisp (binary) lambda-cut set of the membership sequence ms with membership >= lcut.

Parameters:

ms : 1d array

Fuzzy membership set.

lcut : float

Value used for lambda-cut, on range [0, 1.0].

Returns:

mlambda : 1d array

Lambda-cut set of ms: ones if ms[i] >= lcut, zeros otherwise.

lambda_cut_boundaries

skfuzzy.defuzzify.lambda_cut_boundaries(x, mfx, lambdacut)[source]

Find exact boundaries where mfx crosses lambdacut using interpolation.

Parameters:

x : 1d array, length N

Universe variable

mfx : 1d array, length N

Fuzzy membership function

lambdacut : float

Floating point value on range [0, 1].

Returns:

boundaries : 1d array

Floating point values of x where mfx crosses lambdacut. Calculated using linear interpolation.

Notes

The values returned by this function can be thought of as intersections between a hypothetical horizontal line at lambdacut and the membership function mfx. This function assumes the end values of mfx continue on forever in positive and negative directions. This means there will NOT be crossings found exactly at the bounds of x unless the value of mfx at the boundary is exactly lambdacut.

lambda_cut_series

skfuzzy.defuzzify.lambda_cut_series(x, mfx, n)[source]

Determine a series of lambda-cuts in a sweep from 0+ to 1.0 in n steps.

Parameters:

x : 1d array

Universe function for fuzzy membership function mfx.

mfx : 1d array

Fuzzy membership function for x.

n : int

Number of steps.

Returns:

z : 2d array, (n, 3)

Lambda cut intevals.