the neuro fuzzy sistem modify the membership function in input or in output?
2 views (last 30 days)
Show older comments
Hello, I wanted to understand what happens to the membership function (in input/output) or rules when I insert in the anfis editor: Sugeno file and a training set.
0 Comments
Answers (1)
Sam Chak
on 28 Sep 2024
In the following simple example, the ANFIS is trained to fit a trapezoidal set-based fuzzy system to the input/output data of an ideal saturation function. We can clearly observe that both the initial trapezoidal input membership function (MF) and the constant output MF are slightly different from the final trapezoidal input MF and constant output MF. ANFIS will update the parameters of both the input and output membership functions.
%% data
x = (-1:0.01:1)';
y = min(max(-5*x, -1), 1); % <-- ideal saturation function
genOpt = genfisOptions('GridPartition');
genOpt.NumMembershipFunctions = 2;
genOpt.InputMembershipFunctionType = 'trapmf';
genOpt.OutputMembershipFunctionType = 'constant';
inFIS = genfis(x,y,genOpt);
showrule(inFIS)
opt = anfisOptions('InitialFIS', inFIS, 'EpochNumber', 50);
opt.DisplayANFISInformation = 0;
opt.DisplayErrorValues = 0;
opt.DisplayStepSize = 0;
opt.DisplayFinalResults = 0;
outFIS = anfis([x y],opt);
%% plot result
figure
subplot(211)
plotmf(inFIS, 'input', 1), grid on
title('inFIS Input Fuzzy Sets')
subplot(212)
plot(x, [y, evalfis(inFIS, x)]), grid on, ylim([-1.2, 1.2])
title('Compare Data with Untrained ANFIS Output')
legend('Data', 'Untrained ANFIS Output')
inFIS.inputs(1).MembershipFunctions(1).Name
inFIS.inputs(1).MembershipFunctions(1).Type
inFIS.inputs(1).MembershipFunctions(1).Parameters
inFIS.Outputs(1).MembershipFunctions(1).Name
inFIS.Outputs(1).MembershipFunctions(1).Type
inFIS.Outputs(1).MembershipFunctions(1).Parameters
figure
subplot(211)
plotmf(outFIS, 'input', 1), grid on
title('outFIS Input Fuzzy Sets')
subplot(212)
plot(x, [y, evalfis(outFIS, x)]), grid on, ylim([-1.2, 1.2])
title('Compare Data with Trained ANFIS Output')
legend('Data', 'Trained ANFIS Output')
outFIS.inputs(1).MembershipFunctions(1).Name
outFIS.inputs(1).MembershipFunctions(1).Type
outFIS.inputs(1).MembershipFunctions(1).Parameters
outFIS.Outputs(1).MembershipFunctions(1).Name
outFIS.Outputs(1).MembershipFunctions(1).Type
outFIS.Outputs(1).MembershipFunctions(1).Parameters
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!