“Linear dependence in the dictionary” exception in sklearns OMP

前端 未结 1 1165
闹比i
闹比i 2021-01-18 16:39

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

相关标签:
1条回答
  • 2021-01-18 17:10

    The problem was in the data vector y in

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

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

    0 讨论(0)
提交回复
热议问题