Skip to main content
 首页 » 编程设计

python之如何选择包来解决 Python 中的这个凸优化

2025年04月02日12lidabo

我的问题定义如下,

minΣ(||xi-Xci||^2+ λ||ci||),

s.t cii = 0,

where X is a matrix of shape d * n and C is of the shape n * n, xi and ci means a column of X and C separately.

X is known here and based on X we want to find C.

我现在有几个选择,我已经有了 tensorflow 中的版本,它使用了 AdamOptimizer。我只是想知道,有什么办法可以更有效地解决这个问题? cvxpy 或 cvxopt 能更好地解决这个问题吗?

如果你们中的任何人能给我一个除了 tensorflow 之外的任何一种方法的实现,我将不胜感激。

请您参考如下方法:

目标函数,我想,与字典学习(例如你的 X)和稀疏编码(你的 ci)有关,Python 中有几个很好的库。

看看scikit-learn's sparse coding和词典学习。或者你可以使用 SPAMS进行优化。

您已经知道您的字典,所以您需要知道的是稀疏代码。我认为使用 scikit-learns 稀疏编码器是最简单的方法。

如果您想在优化过程中拥有更多权力,您可以自己在 Theano(或 Keras、Lasagne、TensorFlow)中实现它,如 this .