matlab libsvm测试太慢,matlablibsvm测试太慢

a(1)=0;

fori=2:220

a(i)=0.6*a(i-1)+randn;

end

train_t=1:200;

train=a(train_t);

train_t=train_t';

train=train';

test_t=1:203;

test=a(test_t);

test_t=test_t';

test=test';

[bestmse,bestc,bestg]=SVMcgForRegress(train,train_t,-3,11,-7,1,3,0.5,0.5,0.1);

cmd=['-c',num2str(bestc),'-g',num2str(bestg),'-p0.01-s3'];

model=svmtrain(train,train_t,cmd);

[trainpre,trainmse]=svmpredict(train,train_t,model);

figure;

holdon;

plot(train);

plot(trainpre,'r');

title('原来的训练数据的拟合1-200');

legend('原来的训练数据','训练数据预测拟合数据');

holdoff

[testpre,testmse]=svmpredict(test,test_t,model);

figure;

holdon;

plot(test);

plot(testpre,'r');

title('测试数据的预测1-203');

legend('测试数据','测试数据预测拟合数据');

holdoff

如若满意,请点击右侧【采纳答案】,如若还有问题,请点击【】

希望我的回答对您有所帮助,望采纳!

~ O(∩_∩)O~

matlab libSVM识别率的问题

建议你先看一下他的那个入门介绍,A practical Guide to Support Vector Classification.

你需要测试不同的kernel,用每一种kernel都做一下cross-validation,这样才能选择最好的分类器。还有要确定你的16%是正确率还是错误率。也许你看错label了。

Matlab的libsvm 中训练参数怎么输出

c语言版本的也记录在 model 里面.其中model 是一个结构体,其定义如下.

struct svm_model

{

struct svm_parameter param; // parameter

int nr_class; // number of classes, = 2 in regression/one class svm

int l; // total #SV

struct svm_node **SV; // SVs (SV[l])

double **sv_coef; // coefficients for SVs in decision functions (sv_coef[k-1][l])

double *rho; // constants in decision functions (rho[k*(k-1)/2])

double *probA; // pariwise probability information

double *probB;

// for classification only

int *label; // label of each class (label[k])

int *nSV; // number of SVs for each class (nSV[k])

// nSV[0] + nSV[1] + ... + nSV[k-1] = l

// XXX

int free_sv; // 1 if svm_model is created by svm_load_model

// 0 if svm_model is created by svm_train

};

里面的sv_coef就是指向 拉格朗日参数(可能乘了1或者-1)的指针的指针

=============

其实用Matlab版本的更方便

转载请注明出处365教育网 » matlablibsvm测试太慢

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值