在使用Matlab自带函数svmtrain进行训练二维分类器时,得到了如下的错误提示:
U
nable to solve the optimization problem: Maximum number of iterations exceeded; increase options.MaxIter. To continue solving the problem with the current solution as the starting point, set x0 = x before calling quadprog.
意思就是:在默认的最大爹地次数中,不能拟合数据。
我查了一下文档发现有默认迭代次数默认的最大值是15000次,个人感觉这个次数能够应付绝大多数情况,如果到了这个次数还没有得到结果,建议还是在训练样本的选择上下点功夫吧。一个好的样本,即使数据量有一万,用SVM训练也不过几秒钟;相反,如果数据交叉错综复杂,即使500个数据也会计算很久也得不到结果。原话如下:
'options'
MaxIter Integer that specifies the maximum number of iterations of the main loop. If this limit is exceeded before the algorithm converges, then the algorithm stops and returns an error. Default is 15000.
看到这里,一个直观的想法就是增大迭代次数,可是进入工具箱函数源代码来修改很麻烦,能不能像svmtrain的其他接口(比如核函数)那样进行设置呢?答案是肯定的,设置方法如下:
option =
statset(‘MaxIter’,30000); % 设置迭代次数为30000
svmStruct = svmtrain( Training, Group, 'Kernel_Function', 'rbf', 'quadprog_opts', option );
或者使用第二种方法:
option = optim
set(‘MaxIter’,30000); % 设置迭代次数为30000
svmStruct = svmtrain( Training, Group, 'Kernel_Function', 'rbf', 'quadprog_opts', option );
在寻找解决方法的时候,我发现pengyanyan和Vivek两位小伙伴也遇到了这个问题,在不同的论坛提问,这里附上地址:
http://stackoverflow.com/questions/6560031/svmtrain-unable-to-solve-the-optimization-problem
http://www.ilovematlab.cn/thread-252606-1-1.html
转自:
http://blog.csdn.net/amazingjack/article/details/27083103
在使用Matlab自带函数svmtrain进行训练二维分类器时,得到了如下的错误提示:Unable to solve the optimization problem: Maximum number of iterations exceeded; increase options.MaxIter. To continue solving the problem with the curre
LinearSVC(penalty='l2', loss='squared_hinge', dual=True, tol=0.0001, C=1.0, multi_class='ovr', fit_intercept=True,
intercept_scaling=...
刚看完HMM,因为有个ME-HMM方法,所以再看看最大熵模型,最后再把CRF模型看看,这一系列理论大体消化一下,补充一下自己的大脑,方便面试什么的能够应付一些问题。
多读书,多思考,肚子里才有东西。
==========
什么是熵?咱们这里只看信息以及自然界的熵吧。《Big Bang
Theory》
中
Sheldon也经常把这个熵挂在嘴边。在咱们的生活
中
,你打碎了一块玻璃,或者洒落了一...
转自:http://www.zhizhihu.com/html/y2011/3489.html
刚看完HMM,因为有个ME-HMM方法,所以再看看最大熵模型,最后再把CRF模型看看,这一系列理论大体消化一下,补充一下自己的大脑,方便面试什么的能够应付一些问题。
多读书,多思考,肚子里才有东西。
==========
什么是熵?咱们这里只看信息以及自然界的熵吧。《Big Bang The
上面《
Max
Ent: 最大熵模型(
Max
imum Entropy Models)(一)》
其实就是讲了下熵,下面我们继续最大熵模型(
Max
imum Entropy Models)。
最大熵原理指出,当我们需要对一个随机事件的概率分布进行预测时,我们的预测应当满足全部已知的条件,而对未知的情况不要做任何主观假设。在这种情
况下,概率分布最均匀,预测的风险最小。因为这时概率分布的信息熵最大,所以...
```
matlab
SVM
Model =
svm
train
(
train
ingData, group)
SVM
Model =
svm
train
(
train
ingData, group, 'Name', 'Value')
其
中
,`
train
ingData`是一个m×n的矩阵,代表训练数据集,每行是一个样本,每列是一个特征;`group`是一个m×1的向量,代表训练数据集每个样本对应的类别标签。
你还可以通过提供一些参数来自定义
SVM
模型的训练过程。例如,你可以使用`'Kernel_Function'`参数指定核函数类型(如线性核、高斯核等),以及其他一些参数来调整模型的性能和行为。
请注意,
SVM
在
MATLAB
中
的实现要求统计和机器学习工具箱(Statistics and Machine Learning Toolbox)的安装。