Jahidul Islam Tanmay
Jahidul Islam Tanmay

Reputation: 23

How can I train my ANFIS dataset in MATLAB?

I have some following dataset of 9 years that represents the people per infected of dengue from 2007 to 2015 divide in four quadrant in each year. How can I prepare my dataset for ANFIS. and train them to predict previous year record ?

enter image description here

Upvotes: 0

Views: 779

Answers (1)

NKN
NKN

Reputation: 6434

For an FIS with N inputs, training data has N+1 columns, where the first N columns contain input data and the final column contains output data. Here you can choose to have 2 inputs (the year and the quadrant) and one output (the value). In this way for 9 years, the number of rows becomes 36. The number of columns is equal to the number of inputs + output (2+1).

a = 1:4;
b = (2007:2015)';
[A,B] = meshgrid(a,b);
A = A(:);
B = B(:);
C = ones(36,1); % you should insert your numbers here from the table
trainData = [B A C]

Now try to use genfis to generate a FIS:

numMFs = 5;   % number of membership function
mfType = 'gbellmf'; % type of MF
fis = genfis1(trainData,numMFs,mfType); 

the more compact way becomes:

[A,B] = meshgrid(a,b);
trainData = [A(:) B(:) C];

Upvotes: 2

Related Questions