function InferenceEngineandDefuzzification(combination,trainingdata,validationdata,testdata,knowledgeRuleBase,indicesinputs,indicesoutputs) |
fis = newfis(put the fis file name); |
define the defuzzification method; |
for i = 1: size(indicesinputs,2) |
put input variable name; |
assign ranges for the input variables; |
for j = 1: inputs(indicesinputs(combination,i) |
put name to the membership function for the input variable |
put type to the membership function for the input variable |
if type == ‘trapmf’ |
put parameters = knowledgeDataBase(j,:,indicesinputs(combination,i)); |
else |
put parameters = knowledgeDataBase(j,[1,2,4],indicesinputs(combination,i)); |
end |
end |
end |
for i = 1: size(indicesoutputs,2) |
put output variable name; |
assign ranges for the output variables; |
for j = 1: inputs(indicesoutputs(combination,i) |
put name to the membership function for the output variable |
put type to the membership function for the output variable |
if type == ‘trapmf’ |
put parameters = knowledgeDataBase(j,:,indicesoutputs(combination,i)); |
else |
put parameters = knowledgeDataBase(j,[1,2,4],indicesoutputs(combination,i)); |
end |
end |
end |
for m = 1: size(knowledgeRuleBase,1) |
put antecedents; |
put consequents; |
put weights; |
put connections; |
end |
namevars = concatenate(‘Vars_’,indicesinputs(combination,:)); |
[performances(:,:,combination)] = CrispOutputs(fis,trainingdata,validationdata,testingdata,indicesinputs,indicesoutputs,combination); |
namefis = concatenate(performances(:,:,combination),’#_vars’,size(indicesinputs,2),’_’,namevars); |
save the fis file: ‘*.fis’ with the namefis variable; |
save the variables: ‘*.mat’ with the namefis variable; |
end |