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的更多相关文章

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

    Spark MLlib Deep Learning Deep Belief Network (深度学习-深度信念网络)2.3 http://blog.csdn.net/sunbow0 第二章Deep ...

  2. Deep Belief Network简介

    Deep Belief Network简介 1. 多层神经网络存在的问题 常用的神经网络模型, 一般只包含输入层, 输出层和一个隐藏层: 理论上来说, 隐藏层越多, 模型的表达能力应该越强.但是, 当 ...

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

    from:http://www.cnblogs.com/kemaswill/p/3266026.html 1. 多层神经网络存在的问题 常用的神经网络模型, 一般只包含输入层, 输出层和一个隐藏层: ...

  4. 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 ...

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

    Spark MLlib Deep Learning Deep Belief Network (深度学习-深度信念网络)2.2 http://blog.csdn.net/sunbow0 第二章Deep ...

  6. 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的简单理解 ...

  7. 转【面向代码】学习 Deep Learning(二)Deep Belief Nets(DBNs)

    [面向代码]学习 Deep Learning(二)Deep Belief Nets(DBNs) http://blog.csdn.net/dark_scope/article/details/9447 ...

  8. 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 目录 作者和相关链接 方法概括 ...

  9. 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 ...

随机推荐

  1. MongoDB:The Definitive Guide CHAPTER 1 Introduction

    MongoDB is a powerful, flexible, and scalable data store. It combines the ability to scale out with ...

  2. Android开发——新特性与知识点回顾

    Fragment 用途:在一个Activity里切换界面,切换界面时只切换Fragment里面的内容 生命周期方法跟Activity一致,可以理解把其为就是一个Activity 定义布局文件作为Fra ...

  3. How to easily concatenate text based on criteria in Excel? 如何将Excel中的文本按条件合并

    To combine text with the unique ID numbers, you can extract the unique values first and then create ...

  4. [Oracle] - 性能优化工具(5) - AWRSQL

    在AWR中定位到问题SQL语句后想要了解该SQL statement的详细运行计划,于是就用AWR报告中得到的SQL ID去V$SQL等几个动态性能视图中查询,但发现V$SQL或V$SQL_PLAN视 ...

  5. ngnix apache tomcat集群负载均衡配置

    http://w.gdu.me/wiki/Java/tomcat_cluster.html 参考: Tomcat与Apache或Nginx的集群负载均衡设置: http://huangrs.blog. ...

  6. [TypeScript ] What Happens to Compiled Interfaces

    This lesson covers using your first TypeScript Interface and what happens to the Interface when it i ...

  7. GDB-Dashboard-GDB可视化界面

    项目地址 https://github.com/cyrus-and/gdb-dashboard 项目介绍 gdb-dashboard是一个gdb的可视化界面,可以通过web或者终端来现实可视化信息,支 ...

  8. careercup-数组和字符串1.3

    1.3 给定两个字符串,请编写程序,确定其中一个字符串的字符重新排序后,能否变成另一个字符串. C++实现代码: #include<iostream> #include<map> ...

  9. iOS UIKit:CollectionView之布局(2)

    Collection view使用UICollectionViewFlowLayout对象来管理section中的cell,该对象是一种流布局方式,即在collection view中的section ...

  10. IIS Shared Configuration

    Introduction The Internet changes the ways in which companies handle their day-to-day business and h ...