Functions
- pyit2fls.T1FS_Emphasize(t1fs, m=2.0)
Function for creating emphasized T1FSs.
Parameters
t1fs : T1FS
Type 1 fuzzy set to be emphasized.
m : float, optional
Emphasis degree. The default value is 2.
Returns
- emphasized
T1FS
Emphasized type 1 fuzzy set.
- pyit2fls.T1FS_plot(*sets, title=None, legends=None, filename=None, ext='pdf', grid=True, xlabel='Domain', ylabel='Membership degree', legendloc='best', bbox_to_anchor=None, alpha=0.5)
Plots multiple T1FSs together in the same figure.
Parameters
*sets : Multiple number of T1FSs which would be plotted.
title : str
If set, it indicates the title to be represented in the plot. If not set, the plot would not have a title.
legends : List of strs
List of legend texts to be presented in the plot. If not set, no legend would be included in the plot.
filename : str
If set, the plot would be saved as a filename.ext file.
ext : str
Extension of the output file with “pdf” as the default value.
grid : bool
Grid on/off.
xlabel : str
Label of the x axis.
ylabel : str
Label of the y axis.
Examples
>>> domain = linspace(0., 1., 100) >>> t1fs1 = T1FS(domain, gaussian_mf, [0.33, 0.2, 1.]) >>> t1fs2 = T1FS(domain, gaussian_mf, [0.66, 0.2, 1.]) >>> T1FS_plot(t1fs1, t1fs2, title="Plotting T1FSs", legends=["First set", "Second set"])
- pyit2fls.T1FS_AND(domain, t1fs1, t1fs2, t_norm)
AND operator for T1FSs.
Parameters
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the output T1FS.
t1fs1 : T1FS
First input of the AND operator.
t1fs2 : T1FS
Second input of the AND operator.
t_norm : function
The t-norm function to be used.
Returns
output : T1FS
Returns the AND of the two input T1FSs.
Examples
>>> domain = linspace(0., 1., 100) >>> t1fs1 = T1FS(domain, gaussian_mf, [0.33, 0.2, 1.]) >>> t1fs2 = T1FS(domain, gaussian_mf, [0.66, 0.2, 1.]) >>> t1fs3 = T1FS_AND(domain, t1fs1, t1fs2, min_t_norm) >>> t1fs3.plot()
- pyit2fls.T1FS_OR(domain, t1fs1, t1fs2, s_norm)
OR operator for T1FSs.
Parameters
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the output T1FS.
t1fs1 : T1FS
First input of the OR operator.
t1fs2 : T1FS
Second input of the OR operator.
s_norm : function
The s-norm function to be used.
Returns
output : T1FS
Returns the OR of the two input T1FSs.
Examples
>>> domain = linspace(0., 1., 100) >>> t1fs1 = T1FS(domain, gaussian_mf, [0.33, 0.2, 1.]) >>> t1fs2 = T1FS(domain, gaussian_mf, [0.66, 0.2, 1.]) >>> t1fs3 = T1FS_OR(domain, t1fs1, t1fs2, max_s_norm) >>> t1fs3.plot()
- pyit2fls.IT2FS_Emphasize(it2fs, m=2.0)
Function for creating emphasized IT2FSs.
Parameters
it2fs : IT2FS
Interval type 2 fuzzy set to be emphasized.
m : float, optional
Emphasis degree. The default value is 2.
Returns
emphasized : IT2FS
Emphasized interval type 2 fuzzy set.
- pyit2fls.IT2FS_plot(*sets, title=None, legends=None, filename=None, ext='pdf', grid=True, xlabel='Domain', ylabel='Membership degree', legendloc='best', bbox_to_anchor=None, alpha=0.5)
Plots multiple IT2FSs together in the same figure.
Parameters
*sets:
Multiple number of IT2FSs which will be plotted.
title : str
If set, it indicates the title to be represented in the plot. If not set, the plot will not have a title.
legends : list of strs
List of legend texts to be presented in plot. If not set, no legend will be in plot.
filename : str
If set, the plot will be saved as a filename.ext file.
ext : str
Extension of the output file with pdf as the default value.
grid : bool
Determines whether the grid is displayed in the plot.
xlabel : str
Label of the x axis.
ylabel : str
Label of the y axis.
Examples
>>> domain = linspace(0., 1., 100) >>> it2fs1 = IT2FS_Gaussian_UncertStd(domain, [0.33, 0.2, 0.05]) >>> it2fs2 = IT2FS_Gaussian_UncertStd(domain, [0.66, 0.2, 0.05]) >>> IT2FS_plot(it2fs1, it2fs2, title="Plotting IT2FSs", legends=["First set", "Second set"])
- pyit2fls.TR_plot(domain, tr, title=None, legend=None, filename=None, ext='pdf', grid=True, xlabel='Domain', ylabel='Membership degree')
Plots a type reduced IT2FS.
Parameters
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the IT2FS.
tr : Tuple (l, r)
Indicates the type reduced set to be plotted.
title : str
If set, it indicates the title which will be represented in the plot. If not set, the plot will not have a title.
legend : str
If set, it indicates the legend text which will be represented in the plot. If not set, the plot will not contain a legend.
filename : str
If set, the plot will be saved as a filename.ext file.
ext : str
Extension of the output file with ‘pdf’ as the default value.
grid : bool
Determines whether the grid is displayed in the plot.
xlabel : str
Label of the x axis.
ylabel : str
Label of the y axis.
Examples
>>> tr1 = (0.2, 0.3) >>> TR_plot(linspace(0., 1., 100), tr1)
- pyit2fls.crisp(tr)
Calculates the crisp number obtained from type reduced IT2FS.
Parameters
tr : Tuple (l, r)
A tuple (l, r) representing the type-reduced Interval Type-2 Fuzzy Set (IT2FS).
Returns
output : float
The crisp number resulting from the type-reduced IT2FS.
Examples
>>> tr1 = (0.1, 0.3) >>> print(crisp(tr1))
- pyit2fls.crisp_list(trs, o=None)
Calculates the crisp outputs obtained by calling the evaluate_list function from IT2FLS class.
Parameters
trs : List of Tuples (l, r)
A list of tuples (l, r) representing the type-reduced Interval Type-2 Fuzzy Sets.
o : str
The name of the output variable to be processed. If not given, the crisp outputs are calculated for all output variables.
Returns
output : List of floats or Dictionary of {str: List of float}
List of floats (or Dictionary of Lists of float with output variable names as keys).
- pyit2fls.meet(domain, it2fs1, it2fs2, t_norm)
Meet operator for IT2FSs.
Parameters
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the IT2FS.
it2fs1 : IT2FS
First input of the meet operator.
it2fs2 : IT2FS
Second input of the meet operator.
t_norm : function
The t-norm function to be used.
Returns
output : IT2FS
Returns the meet of the two input IT2FSs.
Examples
>>> domain = linspace(0., 1., 100) >>> it2fs1 = IT2FS_Gaussian_UncertStd(domain, [0.33, 0.2, 0.05, 1.]) >>> it2fs2 = IT2FS_Gaussian_UncertStd(domain, [0.66, 0.2, 0.05, 1.]) >>> it2fs3 = meet(domain, it2fs1, it2fs2, min_t_norm) >>> it2fs3.plot()
- pyit2fls.MEET(domain, t_norm, it2fs, *others)
Meet operator for IT2FSs.
Parameters
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the IT2FS.
t_norm : function
The t-norm function to be used.
it2fs : IT2FS
An interval type 2 fuzzy set as the first input of the meet operator.
others : IT2FS
Other interval type 2 fuzzy sets.
Returns
output : IT2FS
Returns the meet of the input IT2FSs.
Examples
>>> domain = linspace(0., 1., 100) >>> it2fs1 = IT2FS_Gaussian_UncertStd(domain, [0.33, 0.2, 0.05, 1.]) >>> it2fs2 = IT2FS_Gaussian_UncertStd(domain, [0.66, 0.2, 0.05, 1.]) >>> it2fs3 = MEET(domain, min_t_norm, it2fs1, it2fs2) >>> it2fs3.plot()
- pyit2fls.join(domain, it2fs1, it2fs2, s_norm)
Join operator for IT2FSs.
Parameters
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the IT2FS.
it2fs1 : IT2FS
First input of the join operator.
it2fs2 : IT2FS
Second input of the join operator.
s_norm : function
The s-norm function to be used.
Returns
output : IT2FS
Returns the join of the two input IT2FSs.
Examples
>>> domain = linspace(0., 1., 100) >>> it2fs1 = IT2FS_Gaussian_UncertStd(domain, [0.33, 0.2, 0.05, 1.]) >>> it2fs2 = IT2FS_Gaussian_UncertStd(domain, [0.66, 0.2, 0.05, 1.]) >>> it2fs3 = join(domain, it2fs1, it2fs2, max_s_norm) >>> it2fs3.plot()
- pyit2fls.JOIN(domain, s_norm, it2fs, *others)
Join operator for IT2FSs.
Parameters
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the IT2FS.
s_norm : function
The s-norm function to be used.
it2fs : IT2FS
An interval type 2 fuzzy set as the first input of the meet operator.
others : IT2FS
Other interval type 2 fuzzy sets.
Returns
output : IT2FS
Returns the join of the input IT2FSs.
Examples
>>> domain = linspace(0., 1., 100) >>> it2fs1 = IT2FS_Gaussian_UncertStd(domain, [0.33, 0.2, 0.05, 1.]) >>> it2fs2 = IT2FS_Gaussian_UncertStd(domain, [0.66, 0.2, 0.05, 1.]) >>> it2fs3 = JOIN(domain, max_s_norm, it2fs1, it2fs2) >>> it2fs3.plot()
- pyit2fls.Centroid(it2fs, alg_func, domain, alg_params=[])
Centroid type reduction for an interval type 2 fuzzy set.
Parameters
it2fs : IT2FS
IT2FS which would be type reduced.
alg_func : Function
Type reduction algorithm to be used, one of the list below:
KM_algorithm, EKM_algorithm, WEKM_algorithm, TWEKM_algorithm, EIASC_algorithm, WM_algorithm, BMM_algorithm, LBMM_algorithm, and NT_algorithm
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the IT2FS.
alg_params : List
List of parameters of type reduction algorithm if it is needed.
Returns
output : Based on selected type reduction algorithm tuple (l, r) or float
Returns Centroid type reduction of the input IT2FS.
- pyit2fls.CoSet(firing_array, consequent_array, alg_func, domain, alg_params=[])
Center of sets type reduction.
Parameters
firing_array : numpy (m, 2) shaped array
Firing strength of consequents.
consequent_array : List of IT2FS
List of consequents corresponding with the rules of IT2FLS
alg_func : Function
Type reduction algorithm to be used, one of the list below:
KM_algorithm, EKM_algorithm, WEKM_algorithm, TWEKM_algorithm, EIASC_algorithm, WM_algorithm, BMM_algorithm, LBMM_algorithm, and NT_algorithm
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the IT2FS.
alg_params : List
List of parameters of type reduction algorithm if it is needed.
Returns
output : Based on selected type reduction algorithm tuple (l, r) or float
Returns Center of sets type reduction of the input IT2FS.
- pyit2fls.CoSum(it2fs_array, alg_func, domain, alg_params=[])
Center of sum type reduction for an interval type 2 fuzzy set.
Parameters
it2fs_array : List of IT2FSs
List of final IT2FSs achieved by evaluating rule base.
alg_func : Function
Type reduction algorithm to be used, which is one of these:
KM_algorithm, EKM_algorithm, WEKM_algorithm, TWEKM_algorithm, EIASC_algorithm, WM_algorithm, BMM_algorithm, LBMM_algorithm, and NT_algorithm
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the IT2FS.
alg_params : List
List of parameters of type reduction algorithm if it is needed.
Returns
output : Based on selected type reduction algorithm tuple (l, r) or float
Returns Center of sum type reduction of the input IT2FS.
- pyit2fls.Height(it2fs_array, alg_func, domain, alg_params=[])
Height type reduction for an interval type 2 fuzzy set.
Parameters
it2fs_array : List of IT2FSs
List of final IT2FSs achieved by evaluating rule base.
alg_func : Function
Type reduction algorithm to be used, which is one of these:
KM_algorithm, EKM_algorithm, WEKM_algorithm, TWEKM_algorithm, EIASC_algorithm, WM_algorithm, BMM_algorithm, LBMM_algorithm, and NT_algorithm
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the IT2FS.
alg_params : List
List of parameters of type reduction algorithm if it is needed.
Returns
output : Based on selected type reduction algorithm tuple (l, r) or float
Returns Height type reduction of the input IT2FS.
- pyit2fls.ModiHe(it2fs_array, spread_array, alg_func, domain, alg_params=[])
Modified height type reduction for an interval type 2 fuzzy set.
Parameters
it2fs_array : List of IT2FSs
List of final IT2FSs achieved by evaluating rule base.
spread_array : List of spread values corresponding with IT2FSs in it2fs_array.
alg_func: Function
Type reduction algorithm to be used, which is one of these:
KM_algorithm, EKM_algorithm, WEKM_algorithm, TWEKM_algorithm, EIASC_algorithm, WM_algorithm, BMM_algorithm, LBMM_algorithm, and NT_algorithm
domain : numpy (n,) shaped array
Indicates the universe of discourse dedicated to the IT2FS.
alg_params : List
List of parameters of type reduction algorithm if it is needed.
Returns
output : Based on selected type reduction algorithm tuple (l, r) or float
Returns Modified height type reduction of the input IT2FS.