“字典中的线性依赖性" sklearns OMP中的异常 [英] "Linear dependence in the dictionary" exception in sklearns OMP

查看:823
本文介绍了“字典中的线性依赖性" sklearns OMP中的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用sklearns OrthogonalMatchingPursuit 来获取使用 KSVD算法学到的词典对信号进行稀疏编码.但是,在试穿过程中,我得到以下RuntimeWarning:

I'm using sklearns OrthogonalMatchingPursuit to get a sparse coding of a signal using a dictionary learned by a KSVD algorithm. However, during the fit I get the following RuntimeWarning:

/usr/local/lib/python2.7/dist-packages/sklearn/linear_model/omp.py:391: RuntimeWarning:  Orthogonal matching pursuit ended prematurely due to linear
dependence in the dictionary. The requested precision might not have been met.

  copy_X=copy_X, return_path=return_path)

在这些情况下,结果确实不令人满意.我没有得到这个警告的要点,因为在稀疏编码中通常有一个不完整的字典,因此在字典中也存在线性依赖性.对于OMP而言,这不应该是一个问题.实际上,如果字典是方矩阵,也会发出警告.

In those cases the results are indeed not satisfactory. I don't get the point of this warning as it is common in sparse coding to have an overcomplete dictionary an thus also linear dependency within it. That should not be an issue for OMP. In fact, the warning is also raised if the dictionary is a square matrix.

此警告是否还会指出应用程序中的其他问题?

Might this Warning also point to other issues in the application?

推荐答案

问题出在

omp = OrthogonalMatchingPursuit(n_nonzero_coefs=target_sparsity)
omp.fit(D, y)

它包含数量非常少的数字.当我同时标准化yD时,拟合将以预期的精度工作.

It contained numbers with very small magnitude. When I normalize y as well as D the fit works with the expected accuracy.

这篇关于“字典中的线性依赖性" sklearns OMP中的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆