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))
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 ...
- Deep Belief Network简介
Deep Belief Network简介 1. 多层神经网络存在的问题 常用的神经网络模型, 一般只包含输入层, 输出层和一个隐藏层: 理论上来说, 隐藏层越多, 模型的表达能力应该越强.但是, 当 ...
- Deep Belief Network简介——本质上是在做逐层无监督学习,每次学习一层网络结构再逐步加深网络
from:http://www.cnblogs.com/kemaswill/p/3266026.html 1. 多层神经网络存在的问题 常用的神经网络模型, 一般只包含输入层, 输出层和一个隐藏层: ...
- Spark MLlib Deep Learning Deep Belief Network (深度学习-深度信念网络)2.1
Spark MLlib Deep Learning Deep Belief Network (深度学习-深度信念网络)2.1 http://blog.csdn.net/sunbow0 Spark ML ...
- Spark MLlib Deep Learning Deep Belief Network (深度学习-深度信念网络)2.2
Spark MLlib Deep Learning Deep Belief Network (深度学习-深度信念网络)2.2 http://blog.csdn.net/sunbow0 第二章Deep ...
- Deep Learning 17:DBN的学习_读论文“A fast learning algorithm for deep belief nets”的总结
1.论文“A fast learning algorithm for deep belief nets”的“explaining away”现象的解释: 见:Explaining Away的简单理解 ...
- 转【面向代码】学习 Deep Learning(二)Deep Belief Nets(DBNs)
[面向代码]学习 Deep Learning(二)Deep Belief Nets(DBNs) http://blog.csdn.net/dark_scope/article/details/9447 ...
- XiangBai——【AAAI2017】TextBoxes_A Fast Text Detector with a Single Deep Neural Network
XiangBai--[AAAI2017]TextBoxes:A Fast Text Detector with a Single Deep Neural Network 目录 作者和相关链接 方法概括 ...
- 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 netw ...
随机推荐
- Apache Commons 工具集使用简介
Apache Commons包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动.我选了一些比较常用的项目做简单介绍.文中用了很多网上现成的东西,我只是做了一个汇总整理. 一.Comm ...
- Netbeans代码配色主题大搜集
我用netbeans的原因之一就是因为其支持代码配色主题,这是个对于一个代码配色字体控来说是非常重要的一个功能.理所当然的,我也会收集各种配色主题来时常换换口味. 下面就是我目前收集的Netbeans ...
- zzuoj 10407: B.最大岛屿
10407: B.最大岛屿 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 12 Solved: 5[Submit][Status][Web Board ...
- Bitbucket Pull Request和fork
本文参考了http://blog.jobbole.com/76854/ Pull Request在Forking工作流中使用,这个也同样适用于小团队的开发协作和第三方开发者向开源项目的贡献.当你要 ...
- java消息队列使用场景
http://blog.163.com/sir_876/blog/static/11705223201332444647261/ 目前能用到的比较不错的消息队列组件 ,kafka,activeMq, ...
- 【JAVA - SSM】之MyBatis与原生JDBC、Hibernate访问数据库的比较
首先来看一下原生JDBC访问数据库的代码: public static void main(String[] args) { // 数据库连接 Connection connection = null ...
- Bootstrap-基于jquery的bootstrap在线文本编辑器插件Summernote
Summernote是一个基于jquery的bootstrap超级简单WYSIWYG在线编辑器.Summernote非常的轻量级,大小只有30KB,支持Safari,Chrome,Firefox.Op ...
- malloc()与calloc差别
Both the malloc() and the calloc() functions are used to allocate dynamic memory. Each operates slig ...
- mysql 学习笔记5-- 数据库优化
ext4:(rw,noatime,nodiratime,nobarrier,data=ordered)xfs: (rw,noatime,nodiratim,nobarrier,logbufs=8,lo ...
- ATL 工程下添加右击菜单
首先在dllmain.cpp中添加如下声明 HINSTANCE g_hInstance; g_hInstance = hInstance; 源码如下: CPoint point; ::GetCur ...