Should the number of fuzzy rules in ANFIS be equal to the number of input MFs?
4 views (last 30 days)
Show older comments
After the training and trial process is executed, Is the number of rules to be equal to the number of MFs? For information, input number is 5 while after training the number of MF is 3. Prior to training, the trial method was used with different types and numbers of MF.
0 Comments
Answers (1)
Sam Chak
on 22 Apr 2025
Yes, if the Subtractive Clustering method is used to generate the initial fuzzy system in ANFIS.
%% The McDonald's Logo
x = linspace(-6.5, 6.5, 261)';
y = 6*abs(x) - x.^2 + 3.25;
genOpt = genfisOptions('SubtractiveClustering');
inFIS = genfis(x,y,genOpt);
figure
plotrule(inFIS)
opt = anfisOptions('InitialFIS', inFIS, 'EpochNumber', 500);
opt.DisplayANFISInformation = 0;
opt.DisplayErrorValues = 0;
opt.DisplayStepSize = 0;
opt.DisplayFinalResults = 0;
outFIS = anfis([x y],opt);
figure
plotrule(outFIS)
%% plot results
figure
subplot(211)
plotmf(inFIS, 'input', 1), grid on
title('Input MFs in Untrained ANFIS')
subplot(212)
plotmf(outFIS, 'input', 1), grid on
title('Input MFs in Trained ANFIS')
figure
x1 = linspace(-6.5, 6.5, 27*3)';
y1 = 6*abs(x1) - x1.^2 + 3.25;
plot(x1, y1, 'o'), hold on
plot(x, evalfis(outFIS, x), 'linewidth', 1.5), hold off
grid on, ylim([-1 13])
legend('Training Data', 'ANFIS Output', 'location', 'south')
axis equal
xlabel('x'), ylabel('y')
title('Compare Data with Trained ANFIS Output')
0 Comments
See Also
Categories
Find more on Fuzzy Logic Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


