Sparse Coding

  • Sparse coding is a class of unsupervised methods for learning sets of over-complete bases to represent data efficiently. The aim of sparse coding is to find a set of basis vectors  such that an input vector  can be represented as a linear combination of these basis vectors:

  • The advantage of having an over-complete basis is that our basis vectors are better able to capture structures and patterns inherent in the input data 
  • However, with an over-complete basis, the coefficients are no longer uniquely determined by the input vector. Therefore, in sparse coding, we introduce the additional criterion of sparsity to resolve the degeneracy introduced by over-completeness.
  • The sparse coding cost function is defined on a set of m input vectors as: 

    where is a sparsity function which penalizes  for being far from zero. We can interpret the first term of the sparse coding objective as a reconstruction term which tries to force the algorithm to provide a good representation of , and the second term as a sparsity penalty which forces our representation of  (i.e., the learned features) to be sparse. The constant  is a scaling constant to determine the relative importance of these two contributions.

  • Although the most direct measure of sparsity is the  norm, it is non-differentiable and difficult to optimize in general. In practice, common choices for the sparsity cost  are the penalty and the log sparsity
  • It is also possible to make the sparsity penalty arbitrary small by scaling down  and scaling up  by some large constant. To prevent this from happening, we will constrain  to be less than some constant . The full sparse coding cost function hence is:


    where the constant is usually set

  • One problem is that the constraint cannot be forced using simple gradient-based methods. Hence, in practice, this constraint is weakened to a "weight decay" term designed to keep the entries of  small:
  • Another problem is that the L1 norm is not differentiable at 0, and hence poses a problem for gradient-based methods. We will "smooth out" the L1 norm using an approximation which will allow us to use gradient descent. To "smooth out" the L1 norm, we use  in place of , where is a "smoothing parameter" which can also be interpreted as a sort of "sparsity parameter" (to see this, observe that when is large compared to , the is dominated by , and taking the square root yield approximately .
  • Hence, the final objective function is:
  • The set of basis vectors are called "dictionary" ().  is "adapted" to if it can represent it with a few basis vectors, that is, there exists a sparse vector in  such that . We call  the sparse code. It is illustrated as follows: 

Learning

  • Learning a set of basis vectors using sparse coding consists of performing two separate optimizations (i.e., alternative optimization method):

    • The first being an optimization over coefficients  for each training example
    • The second being an optimization over basis vectors across many training examples at once.
  • However, the classical optimization alternates between D and  can achieve good results, but very slow.
  • A significant limitation of sparse coding is that even after a set of basis vectors have been learnt, in order to "encode" a new data example, optimization must be performed to obtain the required coefficients. This significant "runtime" cost means that sparse coding is computationally expensive to implement even at test time, especially compared to typical feed-forward architectures.

Remarks

  • From my view, due to the sparseness enforced in the dictionary learning (i.e., sparse code), the restored matrix is able to remove noise of original matrix, i.e., having some effect of denoising. Hence, Sparse coding could be used to denoise images.

References

Study notes for Sparse Coding的更多相关文章

  1. Machine Learning Algorithms Study Notes(2)--Supervised Learning

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...

  2. Machine Learning Algorithms Study Notes(3)--Learning Theory

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...

  3. Machine Learning Algorithms Study Notes(1)--Introduction

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 目 录 1    Introduction    1 1.1    ...

  4. 理解sparse coding

    理解sparse coding 稀疏编码系列: (一)----Spatial Pyramid 小结 (二)----图像的稀疏表示——ScSPM和LLC的总结 (三)----理解sparse codin ...

  5. [Paper] **Before GAN: sparse coding

    读罢[UFLDL] ConvNet,为了知识体系的完整,看来需要实战几篇论文深入理解一些原理. 如下是未来博文系列的初步设想,为了hold住 GAN而必备的知识体系,也是必经之路. [Paper] B ...

  6. sparse coding

    Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...

  7. 稀疏编码(Sparse Coding)的前世今生(一) 转自http://blog.csdn.net/marvin521/article/details/8980853

    稀疏编码来源于神经科学,计算机科学和机器学习领域一般一开始就从稀疏编码算法讲起,上来就是找基向量(超完备基),但是我觉得其源头也比较有意思,知道根基的情况下,拓展其应用也比较有底气.哲学.神经科学.计 ...

  8. Study notes for Clustering and K-means

    1. Clustering Analysis Clustering is the process of grouping a set of (unlabeled) data objects into ...

  9. sparse coding稀疏表达入门

    最近在看sparse and redundant representations这本书,进度比较慢,不过力争看过的都懂,不把时间浪费掉.才看完了不到3页吧,书上基本给出了稀疏表达的概念以及传统的求法. ...

随机推荐

  1. 杭电oj An easy problem

    </pre><h1 style="color: rgb(26, 92, 200);">An easy problem</h1><stron ...

  2. Oracle语句优化规则(二)

    21.       用EXISTS替换DISTINCT 当提交一个包含一对多表信息(比如部门表和雇员表)的查询时,避免在SELECT子句中使用DISTINCT. 一般可以考虑用EXIST替换  例如: ...

  3. 用jmeter进行多用户并发压力测试 [转]

    近日manager要求对项目进行压力测试,开始对jmeter进行了研究.jmeter是Apache一个开源项目,可对各种项目进行测试,甚至包括junit. 测试要求如下,多用户同时登陆web应用程序, ...

  4. 自定义类StyleSheet跨浏览器操作样式表中的规则

    这是群里网友地瓜提供的一个类,不熟悉样式表对象和样式规则对象的浏览器差异的可以看看 /** * Stylesheet.js: utility methods for scripting CSS sty ...

  5. CentOS 6.5系统安装配置图解教程(详细图文)

    转载:http://www.jb51.net/os/128751.html

  6. Windows Phone 8初学者开发—第11部分:设置SounBoard应用程序

    原文 Windows Phone 8初学者开发—第11部分:设置SounBoard应用程序 原文地址: http://channel9.msdn.com/Series/Windows-Phone-8- ...

  7. docker 数据盘映射方案

    docker run -itd -v /data/:/data1 centos bash // -v 用来指定挂载目录, :前面的/data为本地目录,:后面的/data1 为容器里的目录: dock ...

  8. Python: 在Unicode和普通字符串之间转换

    Unicode字符串可以用多种方式编码为普通字符串, 依照你所选择的编码(encoding): <!-- Inject Script Filtered --> Toggle line nu ...

  9. Dining(最大流)

    Dining Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 11844   Accepted: 5444 Descripti ...

  10. 小程序员在android移动应用上的赚钱经历

    先说说我自己吧,二线城市(以外包为主)的小程序员,工作多年了,月收入5-6K.主要从事asp.net web网站开发,java,c++,php,ruby都懂一些,属于那种对问题不求甚解型,爱好电脑游戏 ...