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. InetAddress Example program in Java

    The InetAddress class has no visible constructors. To create an InetAddress object, you have to use ...

  2. 我的ubuntu配置

    每次装系统都是非常蛋疼的过程,新装的系统还是要配置一下的 首先安装google拼音 sudo apt-get install fcitx fcitx-googlepinyin 然后按装numix主题 ...

  3. c#常用工具类:文件和二进制转换

    //================二进制相关转换类============== #region 将文件转换为二进制数组 /// <summary> /// 将文件转换为二进制数组 /// ...

  4. 安卓开发中Theme.AppCompat.Light的解决方法

    styles.xml中<style name="AppBaseTheme" parent="Theme.AppCompat.Light">提示如下错 ...

  5. 即时通讯(IM)

    即时通讯(IM)功能是APP的重要功能之一,而开发好移动IM却绝非易事.通常来说,IM技术选型至少要解决以下问题:1. 协议选型 2. IM服务器选型 3. 对协议和服务器做相应修改,通常来说直接拿个 ...

  6. 第33日 我疯了集成平台(六)-步履轻盈JQuery(四)

    6一个月28日本,天阴下雨. " 微雨过,小荷翻,榴花开欲燃.玉盆纤手弄清泉,琼珠碎却圆."          古老的JavaScript,且乱且复杂.封装成库,青春焕发,这样人们 ...

  7. mybatis12 Usermapper.xml

    输入和输出映射 通过parameterType完成输入映射,通过resultType和resultMap完成输出映射. 1.1parameterType传递pojo包装对象 可以定义pojo包装类型扩 ...

  8. 启动MYSQL密码审计插件

    http://www.innomysql.com/article/25717.html [root@server-mysql plugin]# pwd /usr/local/mysql56/lib/p ...

  9. mysql学习笔记4---mysql 复制---源代码

    mysql: c:底层 C++:相对上层 主备复制:主库通知备库来取 MYSQL复制源代码代码:SQL文件夹 int start_slave_thread( #ifdef HAVE_PSI_INTER ...

  10. careercup-链表 2.6

    2.6 给定一个有环链表,实现一个算法返回环路的开头结点. 类似leetcode中 Linked List Cycle II C++实现代码: #include<iostream> #in ...