Previous topic

medpy.features.histogram.triangular_membership

Next topic

medpy.features.histogram.gaussian_membership

This Page

medpy.features.histogram.trapezoid_membership

medpy.features.histogram.trapezoid_membership(bin_center, bin_width, smoothness)[source]

Create a trapezium membership function for a fuzzy histogram bin.

Parameters:

bin_center : number

The center of the bin of which to compute the membership function.

bin_width : number

The width of a single bin (all expected to be of equal width).

smoothness : number, optional

The smoothness of the function; determines the neighbourhood affected. See below and fuzzy_histogram for a more detailed explanation

Returns:

trapezoid_membership : function

A trapezoidal membership function centered on the bin.

Notes

For the trapezium function the smoothness factor can be between >0.0 and <0.5. Higher values are excepted, but then the function assumes the shape of the triangular membership function. A value of 0.0 would make the histogram behave like a crisp one.

The trapezium membership function is defined as

\[\begin{split}\mu_{trapez}(x) = \left\{ \begin{array}{ll} 0, & x<a, x>d\\ \frac{x-a}{b-a}, & a\leq x\leq b \\ 1, & b<x<c\\ \frac{d-x}{d-c}, & c\leq x\leq d\\ \end{array} \right.\end{split}\]

where \(a\) is the left lower border, \(b\) the left upper border, \(c\) the right upper border and \(d\) the right lower border of the trapezium.

A smoothness term of 0.1 makes the trapezium function reach by \(0.1 * bin\_width\) into the areas of the adjunct bins, as can be observed in the following figure

“Trapezium functions (1)”

where the bin width is 2 with centers at -2, 0 and 2.

Increasing the smoothness term toward 0.5, the function starts to resemble the triangular membership function, which in fact it becomes for any \(smoothness >= 0.5\). The behavior can be observed in the following graph with \(smoothness=0.4\)

“Trapezium functions (2)”

Lowering the smoothness toward 0.0, on the other hand, leads the trapezium function to behave more and more like a crisp histogram membership, which in fact it becomes at a smoothness of 0.0. The following figure, where the smoothness term is near zero, illustrates this behaviour

“Trapezium functions (3)”