Machine Learning--week4 神经网络的基本概念
之前的学习成果并不能解决复杂的非线性问题
Neural Networks
Sigmoid(logistic) activation function: activation function is another term for \(g(z) = \frac{1}{1+e^{-z}}\)
activation: the value that's computed by and as output by a specific
weights = parameters = \(\theta\)
input units: \(x_1,x_2, x_3,\dots, x_n\)
bias unit/ bias neuron: \(x_0\) 与 \(a_0^{(j)}\)
input units 和 hypothesis 之间的layer 由activation 构成
input wire/ output wire:input wire是指指向目标neuron的箭头,output wire是指从目标neuron指出的箭头
\(a_i^{(j)}\): "activation" of neuron \(i\) or of unit \(i\) in layer \(j\)
\(\Theta^{(j)}\): matrix of weights controlling the function mapping form layer \(j\) to layer \(j+1\)
(注意\(\Theta\)是大写的,因为它需要用到矩阵的形式了)
layer 1 == input layer
layer n == output layer (the last layer)
layer 2 ~ layer n-1 == hidden layer
for example:
\[
\begin{align}
\text{output of layer 1(a hidden lyer)}&\begin{cases}a_1^{(2)} &= g(\Theta_{10}^{(1)}x_0 + \Theta_{11}^{(1)}x_1 + \Theta_{12}^{(1)}x_2 + \Theta_{13}^{(1)}x_3)\\
a_2^{(2)} &= g(\Theta_{20}^{(1)}x_0 + \Theta_{21}^{(1)}x_1 + \Theta_{22}^{(1)}x_2 + \Theta_{23}^{(1)}x_3)\\
a_3^{(2)} &= g(\Theta_{30}^{(1)}x_0 + \Theta_{31}^{(1)}x_1 + \Theta_{32}^{(1)}x_2 + \Theta_{33}^{(1)}x_3)\end{cases}\\
\text{output layer}&\begin{cases}h_\Theta(x) = a_1^{(3)} = g(\Theta_{10}^{(2)}a_0^{(2)} + \Theta_{11}^{(2)}a_1^{(2)} +\Theta_{12}^{(2)}a_2^{(2)} + \Theta_{13}^{(2)}a_3^{(2)})\end{cases}
\end{align}
\]
直观点就是:
\[
\begin{align}
\text{output of layer 1(a hidden lyer)}
&\begin{cases}
a_1^{(2)} &= g(\Theta_{1}^{(1)}a^{(1)})\\
a_2^{(2)} &= g(\Theta_{2}^{(1)}a^{(1)})\\
a_3^{(2)} &= g(\Theta_{3}^{(1)}a^{(1)})
\end{cases}\\
\text{output layer}
&\begin{cases}
h_\Theta(x) = a_1^{(3)} = g(\Theta_{1}^{(2)}a^{(2)})
\end{cases}
\end{align}
\]
)generally, \(\Theta^{(j)}\) will be of dimension \(s_{j+1} \times (s_j+1)\), if network has \(s_j\) units in layer \(j\) and \(s_{j+1}\) units in layer \(j+1\). (\(s_j+1\)中的\(+1\) comes from the addition in \(\Theta^{(j)}\) of the "bias nodes," \(x_0\) and \(\Theta_0^{(j)}\) . In other words the output nodes will not include the bias nodes while the inputs will. )
定义 \(a^{(1)} = x\)
\(z^{j+1} = \Theta^{(j)}a^{(j)}\)
\(x_k^{(j+1)} = \Theta_{k,0}^{(j)}a_0^{(j)} + \Theta_{k,1}^{(j)}a_1^{(j)} + \dots + \Theta_{k,n^{(j)}}^{(j)}a_{n^{(j)}}^{(j)}\quad ,(n^{(j)} \text{ means layer j has } n^{(j)} \text{ activation})\)
\(a^{(j)} = g(z^{(j)}) = g(\Theta^{(j-1)}a^{(j-1)})\quad(j\ge2)\)
设有 \(n\) 个 layers, then the last matrix \(\Theta^{(n)}\) will have only one row which is multiplied by one column \(a^{(j)}\) so that our result is a single number:
\(h_\Theta(x) = a^{(n+1)}=g(z^{(n+1)})\)
Add \(a_0^{(j)}=1\)
Forward Propagation:向前传播
Neural Networks 实际上是使用\(a^{(n-1)}\)layer作为训练logistic regression的特征的,而非input layer,在\(\Theta^{(1)}\)中选择不同的参数可能得到一些复杂的特征,从而的到更好的hypothesis,这样做比直接用\(x_1,x_2,\dots ,x_n\)作为训练特征更好
architecture(架构):the way that neural networks are connected
逻辑表达式对应的\(\theta\):
- \({\rm AND} = (x_1 \bigwedge x_2)\):
- \(\Theta = \begin{bmatrix}-30 &20& 20 \end{bmatrix}\)
- \({\rm NOR} = (\lnot x_1 \bigwedge \lnot x_2)\):
- \(\Theta = \begin{bmatrix}10 & -20& -20 \end{bmatrix}\)
- \({\rm OR} = (x_1 \bigvee x_2)\):
- \(\Theta = \begin{bmatrix}-10 &20& 20 \end{bmatrix}\)
- \({\rm NOT} = (\lnot x)\):
- \(\Theta = \begin{bmatrix}-10 & 20\end{bmatrix}\)
- \({\rm XNOR} = (\lnot x_1 \bigwedge \lnot x_2) \bigvee ( x_1 \bigwedge x_2)\)
- 需要一个hidden layer: \(a_1^{(2)} == (\lnot x_1 \bigwedge \lnot x_2),\quad a_2^{(2)} == (x_1 \bigwedge x_2)\)
- output layer: \(a^{(3)} == (a_1^{(2)} \bigvee a_2^{(2)})\)
逻辑表达式的实现:
令\(x=\begin{bmatrix}1 \\ x_1\\x_2 \end{bmatrix}\), 则 \(a_i = g(\Theta_ix)\)就得到\(\Theta_i\)对应的逻辑运算符运算\(x_1,x_2\)的结果了
比如 \(\Theta_i = \begin{bmatrix}-10 &20& 20 \end{bmatrix}\)那么\(a_i == x_1 \bigvee x_2\)
像\({\rm XNOR}\)这种复杂的逻辑表达式需要借助hidden layer才能算出来
对于 multiclass Classification:
用\(y = \begin{bmatrix}1\\0\\0\\0 \end{bmatrix}, \begin{bmatrix}0\\1\\0\\0 \end{bmatrix}, \begin{bmatrix}0\\0\\1\\0 \end{bmatrix}, \begin{bmatrix}0\\0\\0\\1 \end{bmatrix},\begin{bmatrix}0\\0\\0\\0 \end{bmatrix}\)来表示不同的class,
Machine Learning--week4 神经网络的基本概念的更多相关文章
- 【Machine Learning】机器学习及其基础概念简介
机器学习及其基础概念简介 作者:白宁超 2016年12月23日21:24:51 摘要:随着机器学习和深度学习的热潮,各种图书层出不穷.然而多数是基础理论知识介绍,缺乏实现的深入理解.本系列文章是作者结 ...
- Machine Learning 学习笔记1 - 基本概念以及各分类
What is machine learning? 并没有广泛认可的定义来准确定义机器学习.以下定义均为译文,若以后有时间,将补充原英文...... 定义1.来自Arthur Samuel(上世纪50 ...
- [Machine Learning & Algorithm] 神经网络基础
目前,深度学习(Deep Learning,简称DL)在算法领域可谓是大红大紫,现在不只是互联网.人工智能,生活中的各大领域都能反映出深度学习引领的巨大变革.要学习深度学习,那么首先要熟悉神经网络(N ...
- 【Machine Learning】KNN算法虹膜图片识别
K-近邻算法虹膜图片识别实战 作者:白宁超 2017年1月3日18:26:33 摘要:随着机器学习和深度学习的热潮,各种图书层出不穷.然而多数是基础理论知识介绍,缺乏实现的深入理解.本系列文章是作者结 ...
- 【Machine Learning】Python开发工具:Anaconda+Sublime
Python开发工具:Anaconda+Sublime 作者:白宁超 2016年12月23日21:24:51 摘要:随着机器学习和深度学习的热潮,各种图书层出不穷.然而多数是基础理论知识介绍,缺乏实现 ...
- 【Machine Learning】决策树案例:基于python的商品购买能力预测系统
决策树在商品购买能力预测案例中的算法实现 作者:白宁超 2016年12月24日22:05:42 摘要:随着机器学习和深度学习的热潮,各种图书层出不穷.然而多数是基础理论知识介绍,缺乏实现的深入理解.本 ...
- Coursera《machine learning》--(8)神经网络表述
本笔记为Coursera在线课程<Machine Learning>中的神经网络章节的笔记. 八.神经网络:表述(Neural Networks: Representation) 本节主要 ...
- Andrew Ng 的 Machine Learning 课程学习 (week4) Multi-class Classification and Neural Networks
这学期一直在跟进 Coursera上的 Machina Learning 公开课, 老师Andrew Ng是coursera的创始人之一,Machine Learning方面的大牛.这门课程对想要了解 ...
- Python -- machine learning, neural network -- PyBrain 机器学习 神经网络
I am using pybrain on my Linuxmint 13 x86_64 PC. As what it is described: PyBrain is a modular Machi ...
- 【机器学习Machine Learning】资料大全
昨天总结了深度学习的资料,今天把机器学习的资料也总结一下(友情提示:有些网站需要"科学上网"^_^) 推荐几本好书: 1.Pattern Recognition and Machi ...
随机推荐
- 使用stylus
1. 首先确保 node + npm 环境一切正常. 2. 全局安装 stylus: 在命令行中: npm i stylus@latest -g 3. 此时可以创建 .s ...
- metasploit 常用命令备忘
metasploit 常用命令备忘 MSFconsole Commands-------------------------------------24show exploits 查看所有exp ...
- curl HTTP Header
对于"User-Agent", "Cookie", "Host"这类标准的HTTP头部字段,通常会有另外一种设置方法.curl命令提供了 ...
- 最新版的Chrome不能设置网页编码怎么解?
添加一个Google插件https://chrome.google.com/webstore/detail/set-character-encoding/bpojelgakakmcfmjfilgdlm ...
- 【持续集成】GIT+jenkins+sonar——GIT
一.GIT基础 1.1 git简介 linus用C语言编写 2005年诞生 分布式管理系统 速度快.适合大规模.跨地区多人协同开发 1.2 本地管理.集中式.分布式 1.3 git安装 #CentOS ...
- asp.net session锁导致ajax请求阻塞
问:为了可以顺序访问Session的状态值,Session是否提供了锁定机制?答:Session实现了Reader/Writer的锁机制:当页面对Session具有可写功能(即页面有<%@Pag ...
- 微信小程序中显示与隐藏(hidden)
1.wx.wxml页面部分 <view bindtap='click'>点击</view> //这是显示隐藏的部分 <view hidden="{{hidden ...
- 计算属性和监听,computed,watch
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- ECMAScript基础
概念: 1):区分大小写 2):变量是弱类型的. 3):每行结尾的分号可有可无 4):注释与Java,C和PHP语言的注释相同 5):括号表明代码块 原始值:是存储在栈中的简单数据段,也就是说他们的值 ...
- python-----函数参数类型
#函数参数类型:1 位置参数 2 默认参数 3 关键字参数 4可变参数 包裹位置参数*args 包裹关键字参数 **kargs#参数位置顺序:先位置参数,默认参数,包裹位置,包裹关键字(定义和调用都应 ...