Study notes for Sparse Coding
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.
- The first being an optimization over coefficients
- 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
- Sparse coding: http://ufldl.stanford.edu/wiki/index.php/Sparse_Coding
- Sparse coding: autoencoder interpretation: http://ufldl.stanford.edu/wiki/index.php/Sparse_Coding:_Autoencoder_Interpretation
- Sparse coding: exercise: http://ufldl.stanford.edu/wiki/index.php/Exercise:Sparse_Coding
- Sparse coding and dictionary learning for image analysis, ICCV 2010 tutorial.
Study notes for Sparse Coding的更多相关文章
- Machine Learning Algorithms Study Notes(2)--Supervised Learning
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- Machine Learning Algorithms Study Notes(3)--Learning Theory
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- Machine Learning Algorithms Study Notes(1)--Introduction
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 目 录 1 Introduction 1 1.1 ...
- 理解sparse coding
理解sparse coding 稀疏编码系列: (一)----Spatial Pyramid 小结 (二)----图像的稀疏表示——ScSPM和LLC的总结 (三)----理解sparse codin ...
- [Paper] **Before GAN: sparse coding
读罢[UFLDL] ConvNet,为了知识体系的完整,看来需要实战几篇论文深入理解一些原理. 如下是未来博文系列的初步设想,为了hold住 GAN而必备的知识体系,也是必经之路. [Paper] B ...
- sparse coding
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- 稀疏编码(Sparse Coding)的前世今生(一) 转自http://blog.csdn.net/marvin521/article/details/8980853
稀疏编码来源于神经科学,计算机科学和机器学习领域一般一开始就从稀疏编码算法讲起,上来就是找基向量(超完备基),但是我觉得其源头也比较有意思,知道根基的情况下,拓展其应用也比较有底气.哲学.神经科学.计 ...
- Study notes for Clustering and K-means
1. Clustering Analysis Clustering is the process of grouping a set of (unlabeled) data objects into ...
- sparse coding稀疏表达入门
最近在看sparse and redundant representations这本书,进度比较慢,不过力争看过的都懂,不把时间浪费掉.才看完了不到3页吧,书上基本给出了稀疏表达的概念以及传统的求法. ...
随机推荐
- Onvif协议
ONVIF致力于通过全球性的开放界面标准来推进网络视频在安防市场的应用,这一接口界面标准将确保不同厂商生产的网络视频监控产品具有互通性.2008年11月,论坛正式发布了ONVIF第一版规范ONVIF核 ...
- BZOJ 1202: [HNOI2005]狡猾的商人( 差分约束 )
好像很多人用并查集写的... 前缀和, 则 sumt - sums-1 = v, 拆成2条 : sumt ≤ sums-1 + v, sums-1 ≤ sumt - v 就是一个差分约束, 建图跑SP ...
- django开发简易博客(三)
一.静态文件的使用 首先,新建static目录,目录下分别建立css.js.img三个子目录 修改settings.py文件 STATICFILES_DIRS = ( 'F:/web/static', ...
- Django : Table 'MyDjango.django_admin_log' doesn't exist
原因: 添加admin之后,没有运行 manage.py syncdb 解决方法: 在命令行中运行manage.py syncdb 即可 运行截图:
- QTcpSocket通信编程时阻塞与非阻塞的问题
目标,qt程序作为客户端,windows下winsock作为服务器端,实现两端通信. 开始时写了一个小函数测试: [cpp] view plaincopy QTcpSocket tmpSock; t ...
- hibernate 数据关联一对一 3.2
第一种一对一 person和card,card的id即作为主键,又作为外键 // 各村对方的一个对象 public class Person { private Integer id; privat ...
- java如何把char型数据转换成int型数据(转)
一字符串,String=“2324234535”:把第i个数取出来时是char型的:char temp=String.charAt(i)如何把char型转换成int型?我需要求个尾数之和,如:123的 ...
- VC中TRACE()的用法
个人总结:最近看网络编程是碰到了TRACE语句,不知道在哪里输出,查了一晚上资料也没找出来,今天终于在CSDN上找到了,真是个高地方啊,方法如下: 1.在MFC中加入TRACE语句 2.在TOOLS- ...
- C# 计算器 运算符和数字键的keys对照
keys. private void Computer_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.NumPad0) ...
- poj 3176 Cow Bowling(区间dp)
题目链接:http://poj.org/problem?id=3176 思路分析:基本的DP题目:将每个节点视为一个状态,记为B[i][j], 状态转移方程为 B[i][j] = A[i][j] + ...