function [KnowledgeDataBase, totalmatrix, ranges, MFs] = Fuzzification (matrix, cluster_method, numinputs, numoutputs) |
numvariables = numinputs+numoutputs; |
maxnumrows = 0; |
for i = 1: numvariables |
rowssize(i) = unique(matrix(:,i),’rows’,’stable’);%pivot tables |
if rowssize > maxnumrows |
maxnumrows = rowssize(i); |
end |
end |
if maxnumrows > 20 |
maxnumrows = round(sqrt(maxnurows,0)); |
end |
for i = 1: numvariables |
if rowssize(i) > maxnumrows |
optimaly = round(sqrt(rowssize(i),0)); |
rowssize(i) = optimaly; |
else |
optimaly = rowssize(i); |
end |
if cluster_method == ‘Ward’ |
clustering = clusterdata(matrix(:,i),’linkage’,’ward’,optimaly);%here we apply clustering methods |
else |
clustering = kmeans(matrix(:,i),optimaly); |
end |
totalmatrix = [matrix clustering]; |
[ranges,knowledgeDataBase,MFs] = knowledgeDB(maxnumrows,matrix(:,i),clustering,i); |
end |
end |