How to avoid this error while using psoSVMcgForRegress.m?

조회 수: 2 (최근 30일)
Madhumitha Ramachandran
Madhumitha Ramachandran 2019년 4월 23일
댓글: Walter Roberson 2019년 4월 23일
I am trying to use PSOSVMcgForRegress in Matlab 2018 to optimize SVM parameters using SVM and I am getting the following error:
Error using svmtrain (line 230)
svmtrain has been removed. Use fitcsvm instead.
Error in psoSVMcgForRegress (line 54)
fitness(i) = svmtrain(train_label, train, cmd);
If I replace svmtrain with fitcsvm then I get different set of errors:
Error using internal.stats.parseArgs (line 42)
Wrong number of arguments.
Error in classreg.learning.paramoptim.parseOptimizationArgs (line 5)
[OptimizeHyperparameters,~,~,RemainingArgs] = internal.stats.parseArgs(...
Error in fitcsvm (line 312)
[IsOptimizing, RemainingArgs] = classreg.learning.paramoptim.parseOptimizationArgs(varargin);
Error in psoSVMcgForRegress (line 54)
fitness(i) = fitcsvm(train_label, train, cmd);
Any help would be greatly appreciated.
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 4월 23일
You have two layers of problems:
  1. The code was written expecting libsvm's svmtrain() function, not MATLAB's svmtrain() function. MATLAB's svmtrain() function did not accept a command as the third parameter; after the second parameter it expects name/value pairs
  2. You are executing in a system in which libsvm is either not installed or else is later on the path than the Statistics and Machine Learning Toolbox is
  3. MATLAB's svmtrain has been replaced by fitcsvm, which takes different options than MATLAB's svmtrain did, neither of which was compatible with the "cmd" syntax of libsvm
At this point you can either install libsvm (earlier on the path than the Stats toolbox), or you can update to fitcsvm with parameters appropriate to do equivalent actions to what would have been done with the libsvm call.
I would need to see what was in cmd to suggest what the fitcsvm equivalent would be.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Traveling Salesman (TSP)에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by