SVM parameter optimization using GA

6 ビュー (過去 30 日間)
Josh
Josh 2022 年 12 月 3 日
コメント済み: Josh 2022 年 12 月 7 日
I am facing issues of high prediction error. Please help.
load data1.mat
X = data1(1:83,1:end-1);
Y = data1(1:83,end);
X1 = data1(84:end,1:end-1);
Y1 = data1(84:end,end);
c = cvpartition(Y,'KFold',5,'Stratify',false);
fobj = @(x)kfoldLoss(fitrsvm(X,Y,'CVPartition',c,'KernelFunction','gaussian','BoxConstraint', x(1),'KernelScale',x(2),'Epsilon',x(3)));
intcon = 1; % intcon is the indicator of integer variables
lb = [1e-3,1e-3,1e-3]; % set lower bounds
ub = [1e3,1e1,1e1]; % set upper bounds
[sol,fval] = ga(fobj,3,[],[],[],[],lb,ub,[],intcon);
FinalModel = fitrsvm(X,Y,'KernelFunction', 'gaussian','BoxConstraint', sol(1),'KernelScale',sol(2),'Epsilon',sol(3));
yfit = predict(FinalModel, X1);
RMSE = rmse(yfit,Y1)
  1 件のコメント
Josh
Josh 2022 年 12 月 3 日
編集済み: Josh 2022 年 12 月 4 日
Someone have a look and drop a response please.

サインインしてコメントする。

回答 (1 件)

Sudarshan
Sudarshan 2022 年 12 月 7 日
Hi Josh,
I tried running the script and reproducing the high RMSE values.
  • The RMSE value decreases on taking a higher number of training samples.
  • Instead of using just 83 samples for X, I used 150 samples, and the RMSE significantly decreased from 0.15 to 0.008.
  • The reason for the high RMSE value could be that there are less training samples.
You could try increasing the size of the training dataset and see if that solves the issue.
  1 件のコメント
Josh
Josh 2022 年 12 月 7 日
Thank you Sir for the kind reply when others ignored to drop a reply in the community.
I understand your point of more training samples to reduce the error value, which is true.
Also I wish to improve the error on these samples if possible.
I am not sure how to achieve that.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeModel Building and Assessment についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by