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.
  1. What does ANFIS stand for?
  2. Are there any ANFIS-related publications?
  3. What does ANFIS adjust when it's searching for the optimum?
  4. How big should my set of training data be?
  5. How come GENFIS1 generates a huge number of fuzzy rules? What is the "curse of dimensionality?"
  6. What is the difference between GENFIS1 and GENFIS2?
  7. Which one should I used, GENFIS1 or GENFIS2, to generate the FIS matrix for ANFIS?
  8. Why do I run out of memory when I use just a few input variables?
  9. Instead of using ANFIS, can I use the Optimization Toolbox to tune the parameters in a fuzzy inference system?
  10. What is the difference between the public-domain ANFIS code and the MATLAB ANFIS command?
  11. Is there any routine to convert the output file of public-domain ANFIS code to FIS file readable to FLT?
  12. The command genfis2.m is too slow; any way to speed it up?
  13. How come ANFIS is implemented as an MEX instead of M file?
  14. Why the source code of ANFIS is not shipped with the toolbox? Can I get the C source code for my own research?
  15. Can I use custom objective functions rather than the default sum of squared errors?
  16. How come I don't see much technical coverage of ANFIS in the manual?

  1. What does ANFIS stand for?
    ANFIS stands for "Adaptive-Network-based 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 Neuro-Fuzzy Inference Systems" for mnemonic reason.
  2. Are there any ANFIS-related publications?
    1. J.-S. Roger Jang, `` ANFIS: Adaptive-Network-Based Fuzzy Inference Systems,'' IEEE Transactions on Systems, Man, and Cybernetics, Vol. 23, No. 03, pp 665-685, May 1993.
    2. J.-S. Roger Jang and C.-T. Sun, `` Neuro-Fuzzy Modeling and Control'', The Proceedings of the IEEE, Vol. 83, No. 3, pp 378-406, March 1995.
    3. J.-S. Roger Jang, C.-T. Sun and E. Mizutani, ``Neuro-Fuzzy and Soft Computing: a computational approach to learning and machine intelligence,'' 1996, to be published by Prentice-Hall.
    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.
  3. 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 fine-tune them. For consequent parameters that define the coefficients of each output equations, ANFIS uses the least-squares method to identify them. This approach is thus called hybrid learning method since it combines gradient descent and the least-squares method. Other optimization methods (such as the Gauss-Newton or Levenberg-Marquardt methods) are likely to be included into the ANFIS command in the v2 release.
  4. 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.
  5. 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.
  6. 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 fine-tuned 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 input-output mapping precision already.
  7. 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.
  8. 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.
  9. 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.
  10. What is the difference between the public-domain 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 public-domain ANFIS code only support AND rules, one membership function (generalized bell MF) and one partition style (grid partitioning).
  11. Is there any routine to convert the output file of public-domain ANFIS code to FIS file readable to FLT?
    Yes. You need to get the example para2fis.m from the users' page.
  12. 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 download-able from the users' page.
  13. How come ANFIS is implemented as an MEX instead of M file?
    We did prototype M-files 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.
  14. Why the source code of ANFIS is not shipped with the toolbox?
    We did not ship the ANFIS C-codes since most users won't be needing it. Besides, we can concentrate more on providing an intuitive, user-friendly interface, instead of worrying about C-code layouts and documentations. Therefore we decided to distribute the ANFIS C-code on a case-by-case basis. Please contact the MathWorks if you'd like to have the C-codes for research purposes.
  15. 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.
  16. 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.