Module: intervals

skfuzzy.intervals : Standard operations for intervals, provided as two-element
1-D arrays or iterables.
Functions supported: addition, subtraction, division, multiplication, and
scaling. All interval function names have *val suffix.

Also contains algorithms for the DSW method arithmatic operations on fuzzy sets, which depend upon heavy use of intervals.

skfuzzy.intervals.addval(interval1, interval2) Add intervals interval1 and interval2.
skfuzzy.intervals.divval(interval1, interval2) Divide interval2 into interval1, by inversion and multiplication.
skfuzzy.intervals.dsw_add(x, mfx, y, mfy, n) Add two fuzzy variables together using the restricted DSW method [1].
skfuzzy.intervals.dsw_div(x, mfx, y, mfy, n) Divide one fuzzy variable by another using the restricted DSW method [1].
skfuzzy.intervals.dsw_mult(x, mfx, y, mfy, n) Multiply two fuzzy variables using the restricted DSW method [1].
skfuzzy.intervals.dsw_sub(x, mfx, y, mfy, n) Subtract a fuzzy variable from another by the restricted DSW method [1].
skfuzzy.intervals.multval(interval1, interval2) Multiply intervals interval1 and interval2.
skfuzzy.intervals.scaleval(q, interval) Multiply scalar q with interval interval.
skfuzzy.intervals.subval(interval1, interval2) Subtract interval interval2 from interval interval1.

addval

skfuzzy.intervals.addval(interval1, interval2)[source]

Add intervals interval1 and interval2.

Parameters:

interval1 : 2-element iterable

First interval set.

interval2 : 2-element iterable

Second interval set.

Returns:

Z : 2-element array

Sum of interval1 and interval2, defined as:

Z = interval1 + interval2 = [a + c, b + d]

divval

skfuzzy.intervals.divval(interval1, interval2)[source]

Divide interval2 into interval1, by inversion and multiplication.

Parameters:

interval1 : 2-element iterable

First interval set.

interval2 : 2-element iterable

Second interval set.

Returns:

z : 2-element array

Interval result of interval1 / interval2.

dsw_add

skfuzzy.intervals.dsw_add(x, mfx, y, mfy, n)[source]

Add two fuzzy variables together using the restricted DSW method [1].

Parameters:

x : 1d array

Universe for first fuzzy variable.

mfx : 1d array

Fuzzy membership for universe x. Must be convex.

y : 1d array

Universe for second fuzzy variable.

mfy : 1d array

Fuzzy membership for universe y. Must be convex.

n : int

Number of lambda-cuts to use; a higher number will have greater resolution toward the limit imposed by input sets x and y.

Returns:

z : 1d array

Output universe variable.

mfz : 1d array

Output fuzzy membership on universe z.

Notes

The Dong, Shah, and Wong (DSW) method requires convex fuzzy membership functions. The dsw_* functions return results similar to Matplotlib’s fuzarith function.

References

[R37]W. Dong and H. Shah and F. Wong, Fuzzy computations in risk and decision analysis, Civ Eng Syst, 2, 1985, pp 201-208.

dsw_div

skfuzzy.intervals.dsw_div(x, mfx, y, mfy, n)[source]

Divide one fuzzy variable by another using the restricted DSW method [1].

Parameters:

x : 1d array

Universe for first fuzzy variable.

mfx : 1d array

Fuzzy membership for universe x. Must be convex.

y : 1d array

Universe for second fuzzy variable.

mfy : 1d array

Fuzzy membership for universe y. Must be convex.

n : int

Number of lambda-cuts to use; a higher number will have greater resolution toward the limit imposed by input sets x and y.

Returns:

z : 1d array

Output universe variable.

mfz : 1d array

Output fuzzy membership on universe z.

Notes

The Dong, Shah, and Wong (DSW) method requires convex fuzzy membership functions. The dsw_* functions return results similar to Matplotlib’s fuzarith function.

References

[R38]W. Dong and H. Shah and F. Wong, Fuzzy computations in risk and decision analysis, Civ Eng Syst, 2, 1985, pp 201-208.

dsw_mult

skfuzzy.intervals.dsw_mult(x, mfx, y, mfy, n)[source]

Multiply two fuzzy variables using the restricted DSW method [1].

Parameters:

x : 1d array

Universe for first fuzzy variable.

mfx : 1d array

Fuzzy membership for universe x. Must be convex.

y : 1d array

Universe for second fuzzy variable.

mfy : 1d array

Fuzzy membership for universe y. Must be convex.

n : int

Number of lambda-cuts to use; a higher number will have greater resolution toward the limit imposed by input sets x and y.

Returns:

z : 1d array

Output universe variable.

mfz : 1d array

Output fuzzy membership on universe z.

Notes

The Dong, Shah, and Wong (DSW) method requires convex fuzzy membership functions. The dsw_* functions return results similar to Matplotlib’s fuzarith function.

References

[R39]W. Dong and H. Shah and F. Wong, Fuzzy computations in risk and decision analysis, Civ Eng Syst, 2, 1985, pp 201-208.

dsw_sub

skfuzzy.intervals.dsw_sub(x, mfx, y, mfy, n)[source]

Subtract a fuzzy variable from another by the restricted DSW method [1].

Parameters:

x : 1d array

Universe for first fuzzy variable.

mfx : 1d array

Fuzzy membership for universe x. Must be convex.

y : 1d array

Universe for second fuzzy variable, which will be subtracted from x.

mfy : 1d array

Fuzzy membership for universe y. Must be convex.

n : int

Number of lambda-cuts to use; a higher number will have greater resolution toward the limit imposed by input sets x and y.

Returns:

z : 1d array

Output universe variable.

mfz : 1d array

Output fuzzy membership on universe z.

Notes

The Dong, Shah, and Wong (DSW) method requires convex fuzzy membership functions. The dsw_* functions return results similar to Matplotlib’s fuzarith function.

References

[R40]W. Dong and H. Shah and F. Wong, Fuzzy computations in risk and decision analysis, Civ Eng Syst, 2, 1985, pp 201-208.

multval

skfuzzy.intervals.multval(interval1, interval2)[source]

Multiply intervals interval1 and interval2.

Parameters:

interval1 : 1d array, length 2

First interval.

interval2 : 1d array, length 2

Second interval.

Returns:

z : 1d array, length 2

Interval resulting from multiplication of interval1 and interval2.

scaleval

skfuzzy.intervals.scaleval(q, interval)[source]

Multiply scalar q with interval interval.

Parameters:

q : float

Scalar to multiply interval with.

interval : 1d array, length 2

Interval. Must have exactly two elements.

Returns:

z : 1d array, length 2

New interval; z = q x interval.

subval

skfuzzy.intervals.subval(interval1, interval2)[source]

Subtract interval interval2 from interval interval1.

Parameters:

interval1 : 1d array, length 2

First interval.

interval2 : 1d array, length 2

Second interval.

Returns:

Z : 1d array, length 2

Resultant subtracted interval.