The paper explains the computation process in section 2.3. You do not need non-discrete or centroid value as obtained from evalfis
. I'm assuming you have made all the rules which must be giving one of the 16 classes as output. That means each each output class is associated with at least one rule. According to the paper, you need to:
- Make 16 groups containing rules associated to each output class. One group for yellow, one for white and one for black so on...
- Calculate the strength of each and every rule.
- For each group, find summation of strength value of all the rules contained in that group.
- Then find the group with maximum cumulative sum of strength of its contained rules.
To achieve this, we cannot rely on centroid based defuzzified value. I checked the documentation on evalfis
and below is script that should be able to perform above algorithm. Idea is to collect strength of each rule, order the rules into groups based on rule's output class, then find summation of each group and find maximum.
[output, IRR, ORR, ARR] = evalfis(input, fismat)
m = cat(2, ORR, ARR);
m = sortrows(m, 1)
r = [];
for l = 2 : size(m, 1)
if m(l, 1) ~= m(l - 1, 1)
r = cat(1, r, m(l - 1, :));
else
m(l, 2) = m(l, 2) + m(l - 1, 2);
end
end
if size(m, 1) >= 2
r = cat(1, r, m(size(m, 1), :));
end
% r now contains the final class to be choosen
disp(r)