Tune FIS with Training Data
In the example contained in the Fuzzy logic user guide documentation by mathworks, Tune Fuzzy Inference System at the Command Line, page 225, I understand the code used for tuning the FIS, but i dont know how they come up with tunedfismpgprediction.mat . below is the sample code:
[data,name] = loadGasData;
X = data(:,1:6);
Y = data(:,7);
trnX = X(1:2:end,:); % Training input data set
trnY = Y(1:2:end,:); % Training output data set
vldX = X(2:2:end,:); % Validation input data set
vldY = Y(2:2:end,:); % Validation output data set
dataRange = [min(data)’ max(data)’];
fisin = mamfis;
for i = 1:6
fisin = addInput(fisin,dataRange(i,:),’Name’,name(i),’NumMFs’,2);
end
fisin = addOutput(fisin,dataRange(7,:),’Name’,name(7),’NumMFs’,64);
figure
plotfis(fisin)
options = tunefisOptions(‘Method’,’particleswarm’,…
‘OptimizationType’,’learning’, …
‘NumMaxRules’,64);
options.MethodOptions.MaxIterations = 20;
rng(‘default’)
runtunefis = false;
%% This is the stage where am confused, I dont know how they get tunedfismpgprediction.mat
if runtunefis
fisout1 = tunefis(fisin,[],trnX,trnY,options); %#ok
else
tunedfis = load(‘tunedfismpgprediction.mat’);
fisout1 = tunedfis.fisout1;
fprintf(‘Training RMSE = %.3f MPGn’,calculateRMSE(fisout1,trnX,trnY));
end
plotfis(fisout1)In the example contained in the Fuzzy logic user guide documentation by mathworks, Tune Fuzzy Inference System at the Command Line, page 225, I understand the code used for tuning the FIS, but i dont know how they come up with tunedfismpgprediction.mat . below is the sample code:
[data,name] = loadGasData;
X = data(:,1:6);
Y = data(:,7);
trnX = X(1:2:end,:); % Training input data set
trnY = Y(1:2:end,:); % Training output data set
vldX = X(2:2:end,:); % Validation input data set
vldY = Y(2:2:end,:); % Validation output data set
dataRange = [min(data)’ max(data)’];
fisin = mamfis;
for i = 1:6
fisin = addInput(fisin,dataRange(i,:),’Name’,name(i),’NumMFs’,2);
end
fisin = addOutput(fisin,dataRange(7,:),’Name’,name(7),’NumMFs’,64);
figure
plotfis(fisin)
options = tunefisOptions(‘Method’,’particleswarm’,…
‘OptimizationType’,’learning’, …
‘NumMaxRules’,64);
options.MethodOptions.MaxIterations = 20;
rng(‘default’)
runtunefis = false;
%% This is the stage where am confused, I dont know how they get tunedfismpgprediction.mat
if runtunefis
fisout1 = tunefis(fisin,[],trnX,trnY,options); %#ok
else
tunedfis = load(‘tunedfismpgprediction.mat’);
fisout1 = tunedfis.fisout1;
fprintf(‘Training RMSE = %.3f MPGn’,calculateRMSE(fisout1,trnX,trnY));
end
plotfis(fisout1) In the example contained in the Fuzzy logic user guide documentation by mathworks, Tune Fuzzy Inference System at the Command Line, page 225, I understand the code used for tuning the FIS, but i dont know how they come up with tunedfismpgprediction.mat . below is the sample code:
[data,name] = loadGasData;
X = data(:,1:6);
Y = data(:,7);
trnX = X(1:2:end,:); % Training input data set
trnY = Y(1:2:end,:); % Training output data set
vldX = X(2:2:end,:); % Validation input data set
vldY = Y(2:2:end,:); % Validation output data set
dataRange = [min(data)’ max(data)’];
fisin = mamfis;
for i = 1:6
fisin = addInput(fisin,dataRange(i,:),’Name’,name(i),’NumMFs’,2);
end
fisin = addOutput(fisin,dataRange(7,:),’Name’,name(7),’NumMFs’,64);
figure
plotfis(fisin)
options = tunefisOptions(‘Method’,’particleswarm’,…
‘OptimizationType’,’learning’, …
‘NumMaxRules’,64);
options.MethodOptions.MaxIterations = 20;
rng(‘default’)
runtunefis = false;
%% This is the stage where am confused, I dont know how they get tunedfismpgprediction.mat
if runtunefis
fisout1 = tunefis(fisin,[],trnX,trnY,options); %#ok
else
tunedfis = load(‘tunedfismpgprediction.mat’);
fisout1 = tunedfis.fisout1;
fprintf(‘Training RMSE = %.3f MPGn’,calculateRMSE(fisout1,trnX,trnY));
end
plotfis(fisout1) tunefis, fis, fuzzy inference system MATLAB Answers — New Questions