How do I assign membership functions to the input and output of this ANFIS code
Show older comments
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 = [4 3 2 3 3 4 2] .Attached is the dataset file. The code is:
data = loadpublicHealthHeartDataset;
X = data(:,1:6);
Y = data(:,7);
trnData=[X,Y];
trnX = X(1:2:end,:); % Training input data set
trnY = Y(1:2:end,:); % Training output data set
vldX = X(2:2:end,:); % Validation input data set
vldY = Y(2:2:end,:); % Validation output data set
% Tune the data using Anfis
genAnfis = genfis(trnX,trnY, genfisOptions('GridPartition'));
opt = anfisOptions;
opt.InitialFIS = genAnfis;
opt.ValidationData = [vldX,vldY];
opt.EpochNumber = 30;
anfis1 = anfis(trnData,opt);
% Function to upload the dataset
function data= loadpublicHealthHeartDataset
% Get data from the original data file.
tableData = readtable("heartss.CSV");
% Convert the table to a numerical array
data = table2array(tableData(:, 1:7));
end
1 Comment
Accepted Answer
More Answers (0)
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!


