Azzera filtri
Azzera filtri

what is the issue with my Fuzzy inference system (FIS) code?

7 visualizzazioni (ultimi 30 giorni)
am running the following code in matlab R2023b but it keeps returning the following error message:
Error using genfis
Invalid option sets.
Error in CreateInitialFIS (line 31)
fis = genfis(x, t, options);
Error in main (line 24)
fis=CreateInitialFIS(data,10);
The CreateInitialFIS.m code is:
function fis = CreateInitialFIS(data,nCluster)
if ~exist('nCluster', 'var')
nCluster = 'auto';
end
x = data.TrainInputs;
t = data.TrainTargets;
options = fcmOptions(...
NumClusters=nCluster,...
MaxNumIteration=100,...
MinImprovement=1e-5,...
Display=false);
% Create the FIS
fis = genfis(x, t, options);
end
The main.m code is:
%% Load Data
data=LoadData();
%% Generate Basic FIS
fis=CreateInitialFIS(data,10);
%% Train Using PSO
fis=TrainAnfisUsingPSO(fis,data);
%% Results
% Train Data
TrainOutputs=evalfis(data.TrainInputs,fis);
PlotResults(data.TrainTargets,TrainOutputs,'Train Data');
% Test Data
TestOutputs=evalfis(data.TestInputs,fis);
PlotResults(data.TestTargets,TestOutputs,'Test Data');

Risposta accettata

Sam Chak
Sam Chak il 18 Ott 2023
The error is due to the incorrect usage of the option set. The option set for the genfis() function should be genfisOptions(), while fcmOptions() is the option set for the fcm() function.
%% Load Data
data = rand(100, 5);
%% Generate Basic FIS
fis = CreateInitialFIS(data, 10)
fis =
sugfis with properties: Name: "sugeno41" AndMethod: "prod" OrMethod: "probor" ImplicationMethod: "prod" AggregationMethod: "sum" DefuzzificationMethod: "wtaver" DisableStructuralChecks: 0 Inputs: [1×4 fisvar] Outputs: [1×1 fisvar] Rules: [1×10 fisrule] See 'getTunableSettings' method for parameter optimization.
function fis = CreateInitialFIS(data,nCluster)
if ~exist('nCluster', 'var')
nCluster = 'auto';
end
x = data(:,1:4);
t = data(:,5);
% options = fcmOptions(...
% NumClusters=nCluster,...
% MaxNumIteration=100,...
% MinImprovement=1e-5,...
% Verbose=false);
options = genfisOptions('FCMClustering', ...
NumClusters=nCluster, ...
MaxNumIteration=100, ...
MinImprovement=1e-5, ...
Verbose=false);
% Create the FIS
fis = genfis(x, t, options);
end

Più risposte (1)

Adam Drake
Adam Drake il 17 Ott 2023
Modificato: Adam Drake il 17 Ott 2023
The "Display" option should be "Verbose" according to the documentation for FCM clustering options.

Categorie

Scopri di più su Fuzzy Inference System Tuning in Help Center e File Exchange

Prodotti


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by