ANFIS: getting an errorr that the number of rules needs to be the same as the number of output MF's. Can anyone help explain?

조회 수: 16 (최근 30일)
I am trying to train a Sugueno FIS model with some dummy data for demonstration purposes. The FIS has four inputs each with three MF's. I have successfully loaded the training data but get an error message that the number of rules has to be the same as the number of output membership functions. I have 81 rules in the model. Can someone help me understand what I am doing wrong?

답변 (2개)

Gautham Sholingar
Gautham Sholingar 2016년 9월 22일
Hello Peter,
I understand that you are trying to train a Sugeno-type FIS model with sample data to demonstrate how the ANFIS system works. I am assuming that your problem structure will be similar to some of the examples presented in MATLAB documentation. Execute the following command in your MATLAB command window to open a simple example of using ANFIS to model a system.
>> openExample('fuzzy/TrainANFISWithCustomNumberOfTrainingEpochsExample')
Please feel free to copy this code over as a starting template for your ANFIS test and modify accordingly to suit your datasets.
Some possible troubleshooting steps for your case:
  1. Ensure that the input training data format is compatible with what the “anfis” or “genfis” functions expect
  2. Step through the code using the debugger and identify where the test fails
Please refer to the following documentation for more information on how to use the “anfis” function
If you want a more detailed example with ANFIS, MATLAB comes pre-loaded with an inverse kinematics simulation which uses ANFIS to model the Inverse Kinematics of a 2-joint robot arm.
In order to open this simulation, please execute the following command in the MATLAB command window:
>> openExample('fuzzy_featured/invkine_codepad')
The following link explains how ANFIS is used in this model in detail:
The above links should serve as good starting points and templates to help resolve your issue.

Chad MacDonald
Chad MacDonald 2022년 1월 4일
The ANFIS training algorithm requires that the Sugeno system must not have any rule sharing; that is one rule per output membership function. For more information on the requirements for ANFIS tuning, see Neuro-Adaptive Learning and ANFIS.
Another option is to tune your FIS using using the tunefis function, which was introduced in R2019a. With this function, you can tune your system using other methods, such as genetic algorithms and pattern search. These methods require Global Optimization Toolbox® software and do not have the same constraints as ANFIS training. For more information, see Tuning Fuzzy Inference Systems.
To follow-up on Gautham's previous answer, the command for opening the inverse kinematics example has changed to the following:


Help CenterFile Exchange에서 Fuzzy Logic Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by