⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adassvmmain.m

📁 自己用libsvm封的svm matlab
💻 M
字号:
function adassvmmain(trainfile, trainfilelabel, testfile, testfilelabel, transfered, resultfile, resultfile2, resultfile3, logFile)

[datatraino, colTitletrain, rowTitletrain, traintag] = adasimport(trainfile, trainfilelabel, transfered);
[datatesto, colTitletest, rowTitletest, testtag] = adasimport(testfile, testfilelabel, transfered);

[predictLabel, answer, arratetrain, orsample, rorname, arrate, errorsample, errorname] = adassvm(datatraino', traintag, datatesto', testtag);

adasexportlabel(resultfile2, colTitletest, answer, testtag);
adasexportlabel(resultfile, colTitletrain, predictLabel, traintag);

trainsam = '';
for i = 1 : length(orsample)
    trainsam = [trainsam, '   ', colTitletrain{orsample(i)}];
end
testsam = '';
for i = 1 : length(errorsample)
    testsam = [testsam, '   ', colTitletest{errorsample(i)}];
end    

fid = fopen(resultfile3, 'w');
fprintf(fid, 'SVM result:\ntrain accracy: %3.2f%%', arratetrain * 100);
if (~strcmpi(trainsam, ''))
    fprintf(fid, '\ntrain error sample:\n%s', trainsam);
end
if (arrate >= 0)
    fprintf(fid, '\ntest accuracy %3.2f%%', arrate * 100);
end 
if (~strcmpi(testsam, ''))
    fprintf(fid, '\ntest error sample:\n%s', testsam);
end
fclose(fid);

fid = fopen(logFile, 'w');
fprintf(fid, 'SVM is done successfully!');
fclose(fid);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -