Generate Fuzzy Inference System structure from data using FCM clustering


fismat = genfis3(Xin,Xout) 
fismat = genfis3(Xin,Xout,type) 
fismat = genfis3(Xin,Xout,type,cluster_n) 
fismat = genfis3(Xin,Xout,type,cluster_n,fcmoptions) 


genfis3 generates an FIS using fuzzy c-means (FCM) clustering by extracting a set of rules that models the data behavior. The function requires separate sets of input and output data as input arguments. When there is only one output, you can use genfis3 to generate an initial FIS for anfis training. The rule extraction method first uses the fcm function to determine the number of rules and membership functions for the antecedents and consequents.

fismat = genfis3(Xin,Xout) generates a Sugeno-type FIS structure (fismat) given input data Xin and output data Xout. The matrices Xin and Xout have one column per FIS input and output, respectively.

fismat = genfis3(Xin,Xout,type) generates an FIS structure of the specified type, where type is either 'mamdani' or 'sugeno'.

fismat = genfis3(Xin,Xout,type,cluster_n) generates an FIS structure of the specified type and allows you to specify the number of clusters (cluster_n) to be generated by FCM.

The number of clusters determines the number of rules and membership functions in the generated FIS. cluster_n must be an integer or 'auto'. When cluster_n is 'auto', the function uses the subclust algorithm with a radii of 0.5 and the minimum and maximum values of Xin and Xout as xBounds to find the number of clusters. See subclust for more information.

fismat = genfis3(Xin,Xout,type,cluster_n,fcmoptions) generates an FIS structure of the specified type and number of clusters and uses the specified fcmoptions for the FCM algorithm. If you omit fcmoptions, the function uses the default FCM values. See fcm for information about these parameters.

The input membership function type is 'gaussmf'. By default, the output membership function type is 'linear'. However, if you specify type as 'mamdani', then the output membership function type is 'gaussmf'.

The following table summarizes the default inference methods.

Inference MethodDefault
AND prod


collapse all

Generate Sugeno-Type FIS and Specify Number of Clusters

Obtain the input and output data.

Xin = [7*rand(50,1) 20*rand(50,1)-10];
Xout = 5*rand(50,1);

Generate a Sugeno-type FIS with 3 clusters.

opt = NaN(4,1);
opt(4) = 0;
fismat = genfis3(Xin,Xout,'sugeno',3,opt);

The fourth input argument specifies the number of clusters. The fifth input argument, opt, specifies the options for the FCM algorithm. The NaN entries of opt specify default option values. opt(4) turns off the display of iteration information at the MATLAB™ command line.

To see the contents of fismat, use showfis(fismat).

Plot the input membership functions.

[x,mf] = plotmf(fismat,'input',1);
subplot(2,1,1), plot(x,mf)
xlabel('Membership Functions for Input 1')
[x,mf] = plotmf(fismat,'input',2);
subplot(2,1,2), plot(x,mf)
xlabel('Membership Functions for Input 2')

See Also

| | |

Was this topic helpful?