Azzera filtri
Azzera filtri

how do I set membership function to this ANFIS?

3 visualizzazioni (ultimi 30 giorni)
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);

Risposta accettata

Sam Chak
Sam Chak il 26 Ott 2023
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 Commenti
Sam Chak
Sam Chak il 30 Ott 2023
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 il 30 Ott 2023
ok sir @Sam Chak, thanks for your contribution

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Fuzzy Logic Toolbox in Help Center e File Exchange

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by