Frequently Asked Questions  ANFIS in the Fuzzy Logic Toolbox
This article contains answers to some frequently asked questions on
the ANFIS command in the Fuzzy Logic Toolbox. Before trying out these
answers, you should download the bug fixes of the toolbox from the
users' page.

What does ANFIS stand for?

Are there any ANFISrelated publications?

What does ANFIS adjust when it's searching for the optimum?

How big should my set of training data be?

How come GENFIS1 generates a huge number of fuzzy rules?
What is the "curse of dimensionality?"

What is the difference between GENFIS1 and GENFIS2?

Which one should I used, GENFIS1 or GENFIS2, to generate the FIS
matrix for ANFIS?

Why do I run out of memory when I use just a few input variables?

Instead of using ANFIS, can I use the Optimization Toolbox to
tune the parameters in a fuzzy inference system?

What is the difference between the publicdomain ANFIS code and
the MATLAB ANFIS command?

Is there any routine to convert the output file of publicdomain
ANFIS code to FIS file readable to FLT?

The command genfis2.m is too slow; any way to speed it up?

How come ANFIS is implemented as an MEX instead of M file?

Why the source code of ANFIS is not shipped with the toolbox?
Can I get the C source code for my own research?

Can I use custom objective functions rather than the default sum of
squared errors?

How come I don't see much technical coverage of ANFIS in the manual?

What does ANFIS stand for?

ANFIS stands for "AdaptiveNetworkbased Fuzzy Inference Systems",
as originally proposed in [1] of question 2.
In the Fuzzy Logic Toolbox, we kept the acronym but revised its
full name to "Adaptive NeuroFuzzy Inference Systems" for mnemonic reason.

Are there any ANFISrelated publications?

 J.S. Roger Jang,
``
ANFIS: AdaptiveNetworkBased Fuzzy Inference Systems,''
IEEE Transactions on Systems, Man, and Cybernetics,
Vol. 23, No. 03, pp 665685, May 1993.
 J.S. Roger Jang and C.T. Sun,
``
NeuroFuzzy Modeling and Control'',
The Proceedings of the IEEE, Vol. 83, No. 3, pp 378406, March 1995.
 J.S. Roger Jang, C.T. Sun and E. Mizutani, ``NeuroFuzzy and
Soft Computing: a computational approach to learning and machine
intelligence,'' 1996, to be published by PrenticeHall.
Among these publications, [1] is the original ANFIS paper;
[2] includes both modeling and control techniques; [3] is a
comprehensive coverage of ANFIS plus a number of various applications.

What does ANFIS adjust when it's searching for the optimum?

ANFIS applies two techniques in updating parameters. For premise
parameters that define membership functions, ANFIS employs gradient
descent to finetune them. For consequent parameters that define
the coefficients of each output equations, ANFIS uses the
leastsquares method to identify them. This approach is thus
called hybrid learning method since it combines gradient descent
and the leastsquares method. Other optimization methods (such as
the GaussNewton or LevenbergMarquardt methods) are likely to be
included into the ANFIS command in the v2 release.

How big should my set of training data be?

To achieve good generalization toward unseen data, the size of
training data set should be at least as big as the number of
modifiable parameter in ANFIS. The number of modifiable parameters
is popped up on the screen when you issue the ANFIS command.

How come GENFIS1 generates a huge number of fuzzy rules?
What is the "curse of dimensionality?"

In a fuzzy inference system,
basically there are three types of input space partitioning: grid,
tree, and scattering partitioning. GENFIS1 uses the grid partitioning
and it generates rules by enumerating all possible combinations of
membership functions of all inputs; this leads to an exponential
explosion even when the number of inputs is moderately large.
For instance, for a fuzzy inference system with 10 inputs, each with
two membership functions, the grid partitioning leads to 1024 (=2^10) rules,
which is inhibitively large for any practical learning methods.
The "curse of dimensionality" refers to such situation where the
number of fuzzy rules, when the grid partitioning is used, increases
exponentially with the number of input variables.

What is the difference between GENFIS1 and GENFIS2?

Both GENFIS1 and GENFIS2 use a given training data set to generate
an initial fuzzy inference system (represented by a FIS matrix)
that can be finetuned via the ANFIS command.
However, GENFIS1 and GENFIS2 differ in two aspect.
First, GENFIS1 produces grid partitioning of the input space
(and thus is more likely to have the problem of the
``curse of dimensionality'' described in question 5), while
GENFIS2 uses SUBCLUST (subtractive clustering) to produces
scattering partition.
Secondly, GENFIS1 produce a fuzzy inference system where each
rule has zero coefficients in its output equation, while GENFIS2
applies the backslash ("\") command in MATLAB to identify the coefficients.
Therefore the fuzzy inference system generated by GENFIS1 always needs
subsequent optimization by ANFIS command, while the one generated by
GENFIS2 can sometimes have a good inputoutput mapping precision already.

Which one should I used, GENFIS1 or GENFIS2, to generate the FIS
matrix for ANFIS?

If you have less then 6 inputs and a large size of training data,
use GENFIS1. Otherwise, use GENFIS2. In either case, the number of
training data should be more than or equal to the number of parameters;
see question 4.

Why do I run out of memory when I use just a few input variables?

This is related to the ``curse of dimensionality'' in question 5.
Usually it was caused by the large number of fuzzy rules generated
by GENFIS1. Use GENFIS2 instead to reduce the number of rules and
try again.

Instead of using ANFIS, can I use the Optimization Toolbox to
tune the parameters in a fuzzy inference system?

Yes, you can use GETFIS and SETFIS to retrieve and restore
parameters in a FIS matrix. An example can be found in the MathWorks
Solution Search Engine by typing "fuzzy" and "optimization" as
the keywords.

What is the difference between the publicdomain ANFIS code and
the MATLAB ANFIS command?

The ANFIS command is much more flexible and it supports:
 Both AND and OR rules
 Eleven various membership functions
 Both grid and scattering partitioning
On the other hand, the publicdomain
ANFIS code only support AND rules, one membership function
(generalized bell MF) and one partition style (grid partitioning).

Is there any routine to convert the output file of publicdomain
ANFIS code to FIS file readable to FLT?

Yes. You need to get the example para2fis.m from the
users' page.

The command GENFIS2 is too slow; any way to speed it up?

GENFIS2 is inevitably slow since it applies all the training data
to identify coefficients of output equations. (See question 6).
An improved vectorized version that is about an order of magnitude
faster is downloadable from the
users' page.

How come ANFIS is implemented as an MEX instead of M file?

We did prototype Mfiles for ANFIS and found it intolerably slow.
The major reason is that ANFIS is a complicated network structure
and it's hard to do vectorized ANFIS training within MATLAB.

Why the source code of ANFIS is not shipped with the toolbox?

We did not ship the ANFIS Ccodes since most users won't be needing
it. Besides, we can concentrate more on providing an intuitive,
userfriendly interface, instead of worrying about Ccode layouts
and documentations. Therefore we decided to distribute the ANFIS
Ccode on a casebycase basis. Please contact
the MathWorks
if you'd like to have the Ccodes for research purposes.

Can I use custom objective functions rather than the default sum of squared
errors?

For the current release of ANFIS, the error measure (objective
function) to be minimized has to be the sum of squared errors.
To use a different objective function, you can use the
Optimization Toolbox (see question 9). or change the C source
codes (question 14) directly.

How come I don't see much technical coverage of ANFIS in the manual?

Since ANFIS is an advanced technique that is inherently complicated,
so we didn't explain it too much in the manual. Instead, we have
provided several examples of using ANFIS in the manual; advanced
users who are interested in technical details can follow the
ANFIS publications in question 2.