3、Spark MLlib Deep Learning Convolution Neural Network(深度学习-卷积神经网络)3.3

http://blog.csdn.net/sunbow0

第三章Convolution Neural Network (卷积神经网络)

3实例

3.1 測试数据

依照上例数据,或者新建图片识别数据。

3.2 CNN实例

   //2 測试数据

   Logger.getRootLogger.setLevel(Level.WARN)

   valdata_path="/user/tmp/deeplearn/train_d.txt"

   valexamples=sc.textFile(data_path).cache()

   valtrain_d1=examples.map{ line =>

     valf1 = line.split("\t")

     valf =f1.map(f =>
f.toDouble)

     ,)

     ,f.length)

     (,y.length,
,x.length,
,) /
255.0)

   }

   valtrain_d=train_d1.map(f=> (f._1, f._2))

 

   //3 设置训练參数。建立模型

   // opts:迭代步长,迭代次数,交叉验证比例

   valopts= Array(100.0,1.0,0.0)

   train_d.cache

   valnumExamples=train_d.count()

   println(s"numExamples = $numExamples.")

   valCNNmodel=newCNN().

     setMapsize(,, Array(28.0,28.0))).

     setTypes(Array("i",
"c","s","c","s")).

     setLayer().

     setOnum().

     setOutputmaps(Array(0.0,
6.0,0.0,12.0,0.0)).

     setKernelsize(Array(0.0,
5.0,0.0,5.0,0.0)).

     setScale(Array(0.0,
0.0,2.0,0.0,2.0)).

     setAlpha(1.0).

     setBatchsize(50.0).

     setNumepochs(1.0).

     CNNtrain(train_d,opts)

 

   //4 模型測试

   valCNNforecast=CNNmodel.predict(train_d)

   valCNNerror=CNNmodel.Loss(CNNforecast)

   println(s"NNerror = $CNNerror.")

   ),
f.))).take()

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

    until
printf1.length)

     println(printf1(i)._1 +"\t"
+printf1(i)._2 +"\t" + (printf1(i)._2
-printf1(i)._1))   val
numExamples = train_d.count()

   println(s"numExamples = $numExamples.")

   println(mynn._2)

    to
) {

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

   }

   println()

   println("mynn_W1")

   )

    to
) {

      to
) {

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

     }

     println()

   }

   valNNmodel=newNeuralNet().

     setSize(mynn._1).

     setLayer(mynn._2).

     setActivation_function("sigm").

     setOutput_function("sigm").

     setInitW(mynn._3).

     NNtrain(train_d,nnopts)

 

   //5 NN模型測试

   valNNforecast=NNmodel.predict(train_d)

   valNNerror=NNmodel.Loss(NNforecast)

   println(s"NNerror = $NNerror.")

   ),
f.))).take()

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

    until
printf1.length)

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

转载请注明出处:

http://blog.csdn.net/sunbow0

 

 

 

Spark MLlib Deep Learning Convolution Neural Network (深度学习-卷积神经网络)3.3的更多相关文章

  1. Spark MLlib Deep Learning Convolution Neural Network (深度学习-卷积神经网络)3.1

    3.Spark MLlib Deep Learning Convolution Neural Network (深度学习-卷积神经网络)3.1 http://blog.csdn.net/sunbow0 ...

  2. Spark MLlib Deep Learning Convolution Neural Network (深度学习-卷积神经网络)3.2

    3.Spark MLlib Deep Learning Convolution Neural Network(深度学习-卷积神经网络)3.2 http://blog.csdn.net/sunbow0 ...

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

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

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

  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与Neural Network

    深度学习是机器学习研究中的一个新的领域,其动机在于建立.模拟人脑进行分析学习的神经网络,它模仿人脑的机制来解释数据,例如图像,声音和文本.深度学习是无监督学习的一种. 深度学习的概念源于人工神经网络的 ...

  7. 通过Visualizing Representations来理解Deep Learning、Neural network、以及输入样本自身的高维空间结构

    catalogue . 引言 . Neural Networks Transform Space - 神经网络内部的空间结构 . Understand the data itself by visua ...

  8. Deep Learning 教程(斯坦福深度学习研究团队)

    http://www.zhizihua.com/blog/post/602.html 说明:本教程将阐述无监督特征学习和深度学习的主要观点.通过学习,你也将实现多个功能学习/深度学习算法,能看到它们为 ...

  9. 【Deep Learning读书笔记】深度学习中的概率论

    本文首发自公众号:RAIS,期待你的关注. 前言 本系列文章为 <Deep Learning> 读书笔记,可以参看原书一起阅读,效果更佳. 概率论 机器学习中,往往需要大量处理不确定量,或 ...

随机推荐

  1. BZOJ 3680 模拟退火

    思路: 退火就好了-- 1.强烈建议题目名称改为"吊打出题人" 2.这种题放oj上啥心态...-–hzwer 二分TLE和WA 终于AC了-- //By SiriusRen #in ...

  2. POJ 3665 模拟

    按照题意模拟就OK了 //By SiriusRen #include <cstdio> #include <cstring> #include <algorithm> ...

  3. MetaSploit攻击实例讲解------Metasploit自动化攻击(包括kali linux 2016.2(rolling) 和 BT5)

    不多说,直接上干货! 前期博客 Kali linux 2016.2(Rolling)里Metasploit连接(包括默认和自定义)的PostgreSQL数据库 Kali linux 2016.2(Ro ...

  4. c# 结构 struct

    结构是使用 struct 关键字定义的,与类相似,都表示可以包含数据成员和函数成员的数据结构. 一般情况下,我们很少使用结构,而且很多人也并不建议使用结构,但作为.NET Framework 一般型別 ...

  5. html局部页面打印

    1.局部打印函数. function preview(oper) { if (oper < 10) { bdhtml=window.document.body.innerHTML;//获取当前页 ...

  6. Monad的基本运算

    A monad is created by defining a type constructor M and two operations, bind and return (where retur ...

  7. day01-Python介绍,安装,idea

    一. python 简介 Python,读作['paɪθɑn],翻译成汉语是蟒蛇的意思,Python 的 logo 也是两条缠绕在一起的蟒蛇的样子,然而 Python 语言和蟒蛇实际上并没有一毛钱关系 ...

  8. LightOJ-1341 Aladdin and the Flying Carpet 分解质因数(注意对大素数的优化)

    题目链接:https://cn.vjudge.net/problem/LightOJ-1341 题意 给出一个长方形的面积a 让你算整数边长的可能取值,并且两个边都大于给定数字b 思路 唯一分解定理: ...

  9. MySQL好弱智的一个错误

    在sql中执行select是可以查询 但是在linux命令行下执行就报错 ERROR 1059 (42000): Identifier name 'use db_goforit_stati;selec ...

  10. python异步IO-asyncio、async和await

    参考链接: asyncio:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/00 ...