adaptive neuro-fuzzy inference system (ANFIS)
9 views (last 30 days)
Show older comments
Hi. I'm trying to use ANFIS for classification of my data. I have a data set with 15 images, each of which have 22 features extracted. These images need to be classified into four classes using ANFIS. I created FIS using the command fis1 = genfis2(xin,xout,0.1). Where, xin is the matrix containing the extracted features of 15 images (size 15x22) and xout is a column matrix (size 15x1) in which each row shows the class of the respective image. Next, I have used anfisedit. My training data is size 15x23 and I have used the previously generated FIS file (fis1) loaded from workspace. It trains and tests fine and the average test error is also small. Now my questions are 1) I want to generate the FIS file and classify it using commands instead of GUI. How do I do that? I have generated a Matlab script from anfisedit but it's too complicated for me. 2) How does anfisedit classify these images? In the plot window I see circles representing all the inputs I have used. However, many of these inputs belong to the same class and I don't see any representation of any of the classes. I just need 4 classes while in the plot window i see 15 circles. 3) Once I have trained anfis how do I use it to find the class of an unknown image? After all that is the reason I'm doing all of this 4) Lastly I want to plot confusion matrix to see the percentage accuracy of the system. How should I do that?
Thank you in advance. Have a nice day
Answers (1)
Yarpiz / Mostapha Heris
on 12 Sep 2015
Maybe this can help you:
http://www.mathworks.com/matlabcentral/fileexchange/52968-nonlinear-regression-using-anfis-in-matlab
It uses several methods of FIS generation methods (genfis1, genfis2 and genfis3), and uses anfis function, to train the ANFIS structure, programmatically. It is used to solve a nonlinear regression problem; however the classification problem is quite similar to this one, and you can easily modify this code, to achieve your goal.
1 Comment
mekia
on 17 Mar 2020
please debug this code. am try to split pima diabetes dataset with total of 768 into 538 instance for training set,115 for validation set and the rest 115 for test set but the below code cant split like that please help me i don no what is my mistake?
function data=LoadData()
data=load('pima diabetes_dataset');
Inputs=data.Inputs';
Targets=data.Targets';
Targets=Targets(:,1);
nSample=size(Inputs,1);
% Shuffle Data
S=randperm(nSample);
Inputs=Inputs(S,:);
Targets=Targets(S,:);
% Train Data
pTrain=0.7;
nTrain=round(pTrain*nSample);
TrainInputs=Inputs(1:nTrain,:);
TrainTargets=Targets(1:nTrain,:);
% Validation Data
pvalid=0.15;
nvalid=round(pvalid*nSample);
ValInputs=Inputs(nvTrain+1:nvalid,:);
ValTargets=Targets(nTrain+1:nvalid,:);
% Test Data
TestInputs=Inputs(nvalid+1:end,:);
TestTargets=Targets(nvalid+1:end,:);
% Export
data.TrainInputs=TrainInputs;
data.TrainTargets=TrainTargets;
data.ValInputs=ValInputs;
data.ValTargets=ValTargets;
data.TestInputs=TestInputs;
data.TestTargets=TestTargets;
end
See Also
Categories
Find more on Fuzzy Logic Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!