【发布时间】:2017-02-13 22:04:36
【问题描述】:
我正在使用 libSVM,matlab 中的 svmtrain 函数比 C 花费更少的时间。虽然 C - 通常 - 比 matlab 快得多。两个分类器采用相同的参数,并以相同的迭代次数返回相同数量的 SVM。
以下是两者的代码: MATLAB:
t1=cputime;
model = svmtrain(Labels,data, '-h 0 -s 0 -c 0.025 -n 0.01 -b 1 -t 0 -d 1 -p 0.001');
t2=cputime;
fprintf('Elapsed time=%.3f\n',t2-t1)
AND C 代码:
clock_t begin = clock();
model = svm_train(&prob,¶m);
clock_t end = clock();;
double time_spent = (double)(end - begin) / double(CLOCKS_PER_SEC);
【问题讨论】:
-
" 虽然 C - 一般而言 - 比 matlab 快得多" 不一定
-
做更多的运行/基准测试。
标签: c matlab machine-learning svm libsvm