필터 지우기
필터 지우기

how do I set membership function to this ANFIS?

조회 수: 3 (최근 30일)
Ahmad
Ahmad 2023년 10월 26일
댓글: Ahmad 2023년 10월 30일
I want to add membership function to this ANFIS code to be able to train it. the membership function type is Gaussian and the number of mfs is numMembershipFunctions = [3 2 4 3 3 2 3 3 2 3 3 4 3] .The raw code is:
% Observational Data
data = readtable('heart_dataset.csv');
X = table2array(data(:, 1:13)); % 13 Inputs of patient data
Y = table2array(data(:, 14)); % 1 Output (target)
data_Train = [X Y];
% Setting up the initial FIS using Subtractive Clustering method
genOpt = genfisOptions('SubtractiveClustering');
inFIS = genfis(X, Y, genOpt);
anOpt = anfisOptions('InitialFIS', inFIS, 'EpochNumber', 100);
% Training data with ANFIS
outFIS = anfis(data_Train, anOpt);

채택된 답변

Sam Chak
Sam Chak 2023년 10월 26일
In ANFIS training, only the Grid Partitioning method provides the flexibility to assign a fixed number of membership functions and their types for each input. However, for a relatively large dataset with 13 independent variables, genfis() will generate a large number of rules, as estimated below.
% Setting up the initial FIS using Grid Partitioning method
genOpt = genfisOptions('GridPartition');
genOpt.NumMembershipFunctions = [3 2 4 3 3 2 3 3 2 3 3 4 3];
genOpt.InputMembershipFunctionType = "gaussmf";
inFIS = genfis(X, Y, genOpt);
% Check the number of rules will be generated
MFs = [3 2 4 3 3 2 3 3 2 3 3 4 3];
numRules = prod(MFs)
numRules = 839808
  댓글 수: 5
Sam Chak
Sam Chak 2023년 10월 30일
Previously, I demonstrated that the 13-input ANFIS can predict the output perfectly. However, I'm not exactly sure about your current requirements. If ANFIS can predict the output perfectly, why would you want to use neural nets? Although I believe they can also predict the output perfectly. This leads me to deduce that your interest lies in researching the optimization capabilities of PSO itself, rather than the prediction capabilities of ANFIS or neural nets.
Regarding your request for a tutorial about PSO in MATLAB, I must be honest and admit that my knowledge of PSO is limited because I didn't invent the optimization algorithm. I use PSO as a tool, much like a calculator, to help me achieve my goals once the objective function is cleverly formulated. Designing an effective objective function can be considered an art that requires some skill.
If you are interested in inventing a new variant of PSO, you can read about the PSO algorithm here: https://www.mathworks.com/help/gads/particle-swarm-optimization-algorithm.html
You can also find an example that demonstrates how to optimize using the particleswarm() solver here: https://www.mathworks.com/help/gads/optimize-using-particle-swarm-optimization.html
Last but not least, you can explore the options for using the particleswarm() solver here: https://www.mathworks.com/help/gads/particleswarm.html
Ahmad
Ahmad 2023년 10월 30일
ok sir @Sam Chak, thanks for your contribution

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by