フィルターのクリア

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

5 ビュー (過去 30 日間)
Ahmad
Ahmad 2023 年 10 月 17 日
回答済み: Sam Chak 2023 年 10 月 18 日
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');

採用された回答

Sam Chak
Sam Chak 2023 年 10 月 18 日
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

その他の回答 (1 件)

Adam Drake
Adam Drake 2023 年 10 月 17 日
編集済み: Adam Drake 2023 年 10 月 17 日
The "Display" option should be "Verbose" according to the documentation for FCM clustering options.

カテゴリ

Help Center および File ExchangeFuzzy Inference System Tuning についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by