无监督学习:深度自编码器

本文介绍了深度自编码器在无监督学习中的作用,包括降维、文字和图片检索、预训练DNN、去噪编码器以及CNN自编码器。对比PCA,深度自编码器在数据表示上效果更优,且能用于图像去噪和特征提取。预训练DNN通过逐层训练提高网络收敛速度,现已被现代技术替代。去噪编码器增强了模型的鲁棒性,而CNN自编码器结合卷积和池化操作,用于图像处理。
摘要由CSDN通过智能技术生成

1. 从 PCA 开始

  使用PCA对数据进行降维和重构的过程大致上如下图所示

首先将输入的数据乘以一个矩阵得到降维之后的结果,之后再将降维之后的数据乘以之前权重矩阵的转置,恢复得到近似的原始图像。在这个过程中,我们希望输入层与输出层的图像之间越相似越好。这个过程也已通过NN的方式实现,其中 Input layer 到 hidden layer 的过程是编码(encode)过程,而从 hidden layer 到 Output layer 的过程是解码的过程(decode)。因为 hidden layer 得到的结果往往会比原始的维数小,就像一个瓶子的瓶颈一样狭窄,所以也将 hidden layer 称为 bottleneck layer 。

  一个很自然的深度自编码器的想法是如下所示的过程

其中有两点需要注意,首先这里认为前后的权重矩阵是对称的,然而不是对称的也没过关系,因为用的是NN的方法而不是PCA的方法,不必满足前后的对称慈宁宫;其次这个模型原先需要采用RBM的方法逐层初始化,以现在训练NN的技术也可以不用了,所以上面的训练过程和一般的神经网络并没有什么区别。

  下面是一个使用PCA自编码和使用深度神经网络自编码的实验对比结果

我们可以看到都是编码到30维之后再进行解码,深度自编码器的效果比PCA的效果要好很多。其中有一点需要注意,在使用神经网络的时候,第一个隐层的神经元的个数是多于输入层神经元的个数。

  如果用两种方法都将数据降低至2维进行表示,可以看到实验结果如下

可以看到PCA得到的结果将不同种类的数据区分的不是很开,而深度自编码器可以将数据区分的比较开。但是与之前的t-SNE相比还是有一定差距的。

2. 文字检索或者图片检索

将图片或者文字进行深度自编码之后,将它们编码的结果作为它们的特征,将输入的图像或者文字经过同样的编码,在编码后的空间比较相似性,完成文字搜索或者图片搜索。

3. 预训练DNN

  在之前训练DNN的技术没有现在这么先进,所以需要通过预训练的方法帮助网络收敛。具体方法如下

左侧是我们最终希望得到的网络,右边是我进行与训练方法的第一步。我们将数据进行自编码,注意,这里的隐层的神经元的数量远远高于,所以要防止网络根本没有训练,直接将数据传到隐层再传到输出层的情况,所以在训练这一层的时候可以加入一项较大的

Code provided by Ruslan Salakhutdinov and Geoff Hinton Permission is granted for anyone to copy, use, modify, or distribute this program and accompanying programs and documents for any purpose, provided this copyright notice is retained and prominently displayed, along with a note saying that the original programs are available from our web page. The programs and documents are distributed without any warranty, express or implied. As the programs were written for research purposes only, they have not been tested to the degree that would be advisable in any important application. All use of these programs is entirely at the user's own risk. How to make it work: 1. Create a separate directory and download all these files into the same directory 2. Download from http://yann.lecun.com/exdb/mnist the following 4 files: o train-images-idx3-ubyte.gz o train-labels-idx1-ubyte.gz o t10k-images-idx3-ubyte.gz o t10k-labels-idx1-ubyte.gz 3. Unzip these 4 files by executing: o gunzip train-images-idx3-ubyte.gz o gunzip train-labels-idx1-ubyte.gz o gunzip t10k-images-idx3-ubyte.gz o gunzip t10k-labels-idx1-ubyte.gz If unzipping with WinZip, make sure the file names have not been changed by Winzip. 4. Download Conjugate Gradient code minimize.m 5. Download Autoencoder_Code.tar which contains 13 files OR download each of the following 13 files separately for training an autoencoder and a classification model: o mnistdeepauto.m Main file for training deep autoencoder o mnistclassify.m Main file for training classification model o converter.m Converts raw MNIST digits into matlab format o rbm.m Training RBM with binary hidden and binary visible units o rbmhidlinear.m Training RBM with Gaussian hidden and binary visible units o backprop.m Backpropagation for fine-tuning an autoencoder o backpropclassify.m Backpropagation for classification using "encoder" network o CG_MNIST.m Conjugate Gradient optimization for fine-tuning an autoencoder o CG_CLASSIFY_INIT.m Co
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值