No rules fired for Output 1. Defuzzified output value set to its mean range value 2.3873.
31 views (last 30 days)
Show older comments
Someone knows the cause of this warning? and how to solve it?
Warning: No rules fired for Output 1. Defuzzified output value set to its mean range value 2.3873.
> In throwWarning (line 18)
In evalfis (line 93)
Here is my code,
subset = xlsread ('entrenamientoDrastic.csv', 1, 'A1:G420660');
nit = xlsread('nt2006.csv', 1, 'A1:WQ684');
nit = transpose(nit);
nit = reshape(nit,[], 1);
subset(:,7) = ((subset(:, 7)).*nit)/145;
subset = [subset nit];
[subset, ia, ic] = unique(subset,'rows','stable');
%rng('default');
% Cross varidation (train: 70%, test: 30%)
cv = cvpartition(size(subset,1),'HoldOut',0.3);
idx = cv.test;
% Separate to training and test data
train = subset(~idx,:);
test = subset(idx,:);
train_input = train(:, 1:6);
train_output = train(:,7);
test_input = test(:, 1:6);
test_output = test(:, 7);
opt = genfisOptions('FCMClustering','FISType','mamdani');
opt.NumClusters = 10;
opt.Exponent = 8.5;
%opt.Verbose = 2.1;
opt.MaxNumIteration = 100;
opt.MinImprovement = 1e-5;
fis = genfis(train_input,train_output,opt);
% Evaluate FIS
nit = test(:,8);
actY = evalfis(test_input,fis);
% Calculate RMSE
del = actY - test_output;
rmse = sqrt(mean(del.^2));
[rho,pval] = corr(nit,actY,'Type','Spearman');
The rmse gives an Inf value.
0 Comments
Answers (1)
Sam Chak
on 3 Oct 2024
I replicated the Warning message in the example below. It is easier to understand why the warning occurs by examining the Rule Inference diagram. When the input is 0, it does not belong to any of the input fuzzy sets, and therefore, no rule is triggered. By default, the FIS will automatically compute the mean output range value.
fis = mamfis;
% Fuzzy Input #1
fis = addInput(fis, [-1 +1], 'Name', 'in1');
fis = addMF(fis, 'in1', 'linzmf', [-1 -1/4], 'Name', 'N');
fis = addMF(fis, 'in1', 'linsmf', [+1/4 +1], 'Name', 'P');
% Fuzzy Output
fis = addOutput(fis, [-2.3873*2 2.3873*4], 'Name', 'out'); % <-- output range
fis = addMF(fis, 'out', 'trimf', [-2.3873*2 0 2.3873*2], 'Name', 'N');
fis = addMF(fis, 'out', 'trimf', [0 +2.3873*2 2.3873*4], 'Name', 'P');
% Fuzzy Rules
rules = [
"in1==N => out=N"
"in1==P => out=P"
];
fis = addRule(fis, rules);
evalfis(fis, 0)
figure
plotrule(fis)
0 Comments
See Also
Categories
Find more on Fuzzy Logic Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!