Generate Fuzzy Inference System structure from data using subtractive clustering
fismat = genfis2(Xin,Xout,radii) fismat = genfis2(Xin,Xout,radii,xBounds) fismat = genfis2(Xin,Xout,radii,xBounds,options) fismat = genfis2(Xin,Xout,radii,xBounds,options,user_centers)
genfis2 generates a Sugeno-type FIS structure using subtractive clustering and requires separate sets of input and output data as input arguments. When there is only one output, genfis2 may be used to generate an initial FIS for anfis training. genfis2 accomplishes this by extracting a set of rules that models the data behavior.
The rule extraction method first uses the subclust function to determine the number of rules and antecedent membership functions and then uses linear least squares estimation to determine each rule's consequent equations. This function returns a FIS structure that contains a set of fuzzy rules to cover the feature space.
The arguments for genfis2 are as follows:
Xin is a matrix in which each row contains the input values of a data point.
Xout is a matrix in which each row contains the output values of a data point.
radii is a vector that specifies a cluster center's range of influence in each of the data dimensions, assuming the data falls within a unit hyperbox.
For example, if the data dimension is 3 (e.g., Xin has two columns and Xout has one column), radii = [0.5 0.4 0.3] specifies that the ranges of influence in the first, second, and third data dimensions (i.e., the first column of Xin, the second column of Xin, and the column of Xout) are 0.5, 0.4, and 0.3 times the width of the data space, respectively. If radii is a scalar value, then this scalar value is applied to all data dimensions, i.e., each cluster center has a spherical neighborhood of influence with the given radius.
xBounds is a 2-by-N optional matrix that specifies how to map the data in Xin and Xout into a unit hyperbox, where N is the data (row) dimension. The first row of xBounds contains the minimum axis range values and the second row contains the maximum axis range values for scaling the data in each dimension.
For example, xBounds = [-10 0 -1; 10 50 1] specifies that data values in the first data dimension are to be scaled from the range [-10 +10] into values in the range [0 1]; data values in the second data dimension are to be scaled from the range [0 50]; and data values in the third data dimension are to be scaled from the range [-1 +1]. If xBounds is an empty matrix or not provided, then xBounds defaults to the minimum and maximum data values found in each data dimension.
options is an optional vector for specifying algorithm parameters to override the default values. These parameters are explained in the help text for subclust. Default values are in place when this argument is not specified.
user_centers is an optional matrix for specifying custom cluster centers. user_centers has a size of J-by-N where J is the number of clusters and N is the total number of inputs and outputs.
The input membership function type is 'gaussmf', and the output membership function type is 'linear'.
The following table summarizes the default inference methods.
Generate a FIS using subtractive clustering and specify the cluster center's range of influence.
Xin = [7*rand(50,1) 20*rand(50,1)-10]; Xout = 5*rand(50,1); fismat = genfis2(Xin,Xout,0.5);
fismat specifies a range of influence of 0.5 for all data dimensions.
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');
Suppose the input data has two columns, and the output data has one column. Specify 0.5 and 0.25 as the range of influence for the first and second input data columns. Specify 0.3 as the range of influence for the output data.
Xin = [7*rand(50,1) 20*rand(50,1)-10]; Xout = 5*rand(50,1); fismat = genfis2(Xin,Xout,[0.5 0.25 0.3]);
Suppose the input data has two columns, and the output data has one column. Specify the scaling range for the inputs and outputs to normalize the data into the [0 1] range. The ranges for the first and second input data columns and the output data are: [-10 +10], [-5 +5], and [0 20].
Xin = [7*rand(50,1) 20*rand(50,1)-10]; Xout = 5*rand(50,1); fismat = genfis2(Xin,Xout,0.5,[-10 -5 0; 10 5 20]);
Here, the third input argument, 0.5, specifies the range of influence for all data dimensions. The fourth input argument specifies the scaling range for the input and output data.