莫烦theano学习自修第五天【定义神经层】
1. 代码如下:
#!/usr/bin/env python
#! _*_ coding:UTF-8 _*_
import numpy as np
import theano.tensor as T
import theano
class Layer(object):
'''
定义一个神经层
'''
def __init__(self, inputs, in_size, out_size, activation_function=None):
'''神经层的初始化方法'''
self.W = theano.shared(np.random.normal(0, 1, (in_size, out_size)))
self.b = theano.shared(np.zeros((out_size, ) + 0.1))
self.Wx_plus_b = T.dot(inputs, self.W) + self.b
self.activation_function = activation_function
# 增加激励函数的处理
if activation_function is None:
self.outputs = self.Wx_plus_b
else:
self.outputs = self.activation_function(self.Wx_plus_b)
莫烦theano学习自修第五天【定义神经层】的更多相关文章
- 莫烦theano学习自修第九天【过拟合问题与正规化】
如下图所示(回归的过拟合问题):如果机器学习得到的回归为下图中的直线则是比较好的结果,但是如果进一步控制减少误差,导致机器学习到了下图中的曲线,则100%正确的学习了训练数据,看似较好,但是如果换成另 ...
- 莫烦theano学习自修第十天【保存神经网络及加载神经网络】
1. 为何保存神经网络 保存神经网络指的是保存神经网络的权重W及偏置b,权重W,和偏置b本身是一个列表,将这两个列表的值写到列表或者字典的数据结构中,使用pickle的数据结构将列表或者字典写入到文件 ...
- 莫烦theano学习自修第八天【分类问题】
1. 代码实现 from __future__ import print_function import numpy as np import theano import theano.tensor ...
- 莫烦theano学习自修第七天【回归结果可视化】
1.代码实现 from __future__ import print_function import theano import theano.tensor as T import numpy as ...
- 莫烦theano学习自修第六天【回归】
1. 代码实现 from __future__ import print_function import theano import theano.tensor as T import numpy a ...
- 莫烦theano学习自修第三天【共享变量】
1. 代码实现 #!/usr/bin/env python #! _*_ coding:UTF-8 _*_ import numpy as np import theano.tensor as T i ...
- 莫烦theano学习自修第二天【激励函数】
1. 代码如下: #!/usr/bin/env python #! _*_ coding:UTF-8 _*_ import numpy as np import theano.tensor as T ...
- 莫烦theano学习自修第一天【常量和矩阵的运算】
1. 代码实现如下: #!/usr/bin/env python #! _*_ coding:UTF-8 _*_ # 导入numpy模块,因为numpy是常用的计算模块 import numpy as ...
- 莫烦scikit-learn学习自修第五天【训练模型的属性】
1.代码实战 #!/usr/bin/env python #!_*_ coding:UTF-8 _*_ from sklearn import datasets from sklearn.linear ...
随机推荐
- 一)surging 微服务框架使用系列之surging 的准备工作rabbitmq安装(转载 https://www.cnblogs.com/alangur/p/8339905.html)
(一)surging 微服务框架使用系列之surging 的准备工作rabbitmq安装 (1)下载erlang: http://www.erlang.org/download/otp_win64 ...
- Leetcode 1. Two Sum (Python)
refer to https://blog.csdn.net/linfeng886/article/details/79772348 Description Given an array of int ...
- nginx + tomcat = http && https
Tomcat版块配置: vim /to/path/conf/server.xml <Server port="" shutdown="SHUTDOWN"& ...
- pip install报错Can't roll back cryptography; was not uninstalled
当使用pip install或者pip install --upgrade报错 Can't roll back cryptography; was not uninstalled 可以进行以下的尝试: ...
- 如何备份和恢复你的TFS服务器(二)
配置一个备份计划 在你的TFS(Team Foundation Server)2010服务器上安装新版本的Power Tools以后(是的,这个工具只支持TFS(Team Foundation Ser ...
- linux shell中单引号、双引号、反引号、反斜杠的区别
摘自http://www.jb51.net/article/33495.htm 1. 单引号 ( '' ) # grep Susan phonebook Susan Goldberg 403-212- ...
- NFV论文集(二)
一 文章名称:VNF Placement with Replication for Load Balancing in NFV Networks 发表时间:2017 期刊来源:ICC: IEEE In ...
- Choosing The Commander CodeForces - 817E (01字典树+思维)
As you might remember from the previous round, Vova is currently playing a strategic game known as R ...
- web网站css,js更新后客户浏览器缓存问题,需要刷新才能正常展示的解决办法
问题描述 最近将公司官网样式进行了调整,部署到服务器后访问发现页面展示不正常,但是刷新之后就会展示正常. 问题分析 研究之后发现可能的原因有 css文件过大,加载缓慢 本地缓存问题,虽然服务器修改了c ...
- Linux系统mysql使用(一)
一.安装 sudo apt-get update #更新软件源 sudo apt-get install mysql-server #安装mysql 二.启动和关闭 service mysql sta ...