Deep Belief Network

Deep Belief Network
3实例
3.1 测试数据
按照上例数据,或者新建图片识别数据。

3.2 DBN实例
//****************例2(读取固定样本:来源于经典优化算法测试函数Sphere Model)***********//

//2 读取样本数据

Logger.getRootLogger.setLevel(Level.WARN)

valdata_path ="/user/huangmeiling/deeplearn/data1"

valexamples =www.ycyc66.cn/ sc.textFile(data_path).cache()

valtrain_d1 =www.zhenlyule.cn examples.map { line =>

valf1 = line.split("\t")

valf =f1.map(f =>www.egouyuLe.cn f.toDouble)

valid =f(0)

valy = Array(f(1))

valx =f.slice(2,f.length)

(id, new BDM(1,y.length,y),new BDM(1,x.length,x))

}

valtrain_d =train_d1.www.zhenloyl88.cn map(f => (f._2, f._3))

valopts = Array(100.0,20.0,0.0)

//3 设置训练参数,建立DBN模型

valDBNmodel =new DBN().

setSize(Array(5, 7)).

setLayer(2).

setMomentum(0.1).

setAlpha(1.0).

DBNtrain(train_d, opts)

//4 DBN模型转化为NN模型

valmynn =DBNmodel.www.yghrcp88.cn dbnunfoldtonn(1)

valnnopts = Array(100.0,50.0,0.0)

valnumExamples =train_d.count()

println(s"numExamples =www.huacairen88.cn $numExamples.")

println(mynn._2)

for (i <-0 tomynn._1.length -1) {

print(mynn._1(i) +"\t")

}

println()

println("mynn_W1")

valtmpw1 =mynn._3(0)

for (i <-0 totmpw1www.jyz521.com/ .rows -1) {

for (j <-0 totmpw1.cols -1) {

print(tmpw1(i,j) +"\t")

}

println()

}

valNNmodel =new www.ludingyule66.cn NeuralNet().

setSize(mynn._1).

setLayer(mynn._2).

setActivation_function("sigm").

setOutput_function("sigm").

setInitW(mynn._3).

NNtrain(train_d, nnopts)

//5 NN模型测试

valNNforecast =NNmodel.www.yyzx66.cn/ predict(train_d)

valNNerror =NNmodel.Loss(NNforecast)

println(s"NNerror = $NNerror.")

valprintf1 =NNforecast.map(f => (www.myqunliphoto.com/ f.label.data(0), f.predict_label.data(0))).take(200)

println("预测结果——实际值:预测值:误差")

for (i <-0 untilprintf1.length)

println(printf1(i)._1 +"\t" +printf1(i)._2 +"\t" + (printf1(i)._2 -printf1(i)._1))

时间: 2024-10-13 16:15:53

Deep Belief Network的相关文章

Spark MLlib Deep Learning Deep Belief Network (深度学习-深度信念网络)2.3

Spark MLlib Deep Learning Deep Belief Network (深度学习-深度信念网络)2.3 http://blog.csdn.net/sunbow0 第二章Deep Belief Network (深度信念网络) 3实例 3.1 測试数据 依照上例数据,或者新建图片识别数据. 3.2 DBN实例 //****************例2(读取固定样本:来源于经典优化算法測试函数Sphere Model)***********// //2 读取样本数据 Logge

【转载】Deep Belief Network

Deep Belief Network 为了更好的在下次讨论班讲述 DBN,特开此帖.主要是介绍 DBN 的相关知识,做一份逻辑上完整的东西.参考Hinton 的东西来讲吧: reading listRBM 相关[1] 关于 Boltzmann machine 的 scholarwiki[2] Haykin 书上第 11 章[3] Duda 书上第 7 章[4] RBM 的 exponential family 扩展[5] RBM 的建模能力:作为 universal approximator

Spark MLlib Deep Learning Deep Belief Network (深度学习-深度信念网络)2.2

Spark MLlib Deep Learning Deep Belief Network (深度学习-深度信念网络)2.2 http://blog.csdn.net/sunbow0 第二章Deep Belief Network (深度信念网络) 2基础及源代码解析 2.1 Deep Belief Network深度信念网络基础知识 1)综合基础知识參照: http://tieba.baidu.com/p/2895759455   http://wenku.baidu.com/link?url=

Deep Belief Network简介——本质上是在做逐层无监督学习,每次学习一层网络结构再逐步加深网络

from:http://www.cnblogs.com/kemaswill/p/3266026.html 1. 多层神经网络存在的问题 常用的神经网络模型, 一般只包含输入层, 输出层和一个隐藏层: 理论上来说, 隐藏层越多, 模型的表达能力应该越强.但是, 当隐藏层数多于一层时, 如果我们使用随机值来初始化权重, 使用梯度下降来优化参数就会出现许多问题[1]: 如果初始权重值设置的过大, 则训练过程中权重值会落入局部最小值(而不是全局最小值). 如果初始的权重值设置的过小, 则在使用BP调整参

【转载】Project on Learning Deep Belief Nets

Project on Learning Deep Belief Nets Deep Belief Nets (DBN's) will be explained in the lecture on Oct 29. Instead of learning layers of features by backpropagating errors, they learn one layer at a time by trying to build a generative model of the da

根据《Sparse deep belief net model for visual area V2》实现Sparse GRBM

前一部分的求解用Hinton的CD算法即可,后一部分的求解即在前一部分的前提下,加入: %%加入Sparse penalty R.delta=mean(mean(h0,1)-R.sparseP).*mean(h0.*(1-h0),1); R.deltaW=(v0'*repmat(R.delta,minibatch_sz,1))./minibatch_sz; %dW=dW+R.sparseLumda.*; R.vbias = R.vbias + actual_lrate * (vbias_grad

What are the advantages of ReLU over sigmoid function in deep neural network?

The state of the art of non-linearity is to use ReLU instead of sigmoid function in deep neural network, what are the advantages? I know that training a network when ReLU is used would be faster, and it is more biological inspired, what are the other

Learning Notes: Morvan - Reinforcement Learning, Part 4: Deep Q Network

Deep Q Network 4.1 DQN 算法更新 4.2 DQN 神经网络 4.3 DQN 思维决策 4.4 OpenAI gym 环境库 Notes Deep Q-learning Algorithm This gives us the final deep Q-learning algorithm with experience replay: There are many more tricks that DeepMind used to actually make it work

【转载】How to build and run your first deep learning network

How to build and run your first deep learning network Step-by-step instruction on training your own neural network. by Pete Warden | @petewarden | Comments: 8 | July 23, 2014 Share on twitter Share on google_plusone_share Share on facebook Share on l