神经网络:表达(三)

示例一

如上图所示,假设函数hΘ(x)可用数学表达式表示为:


其中,g(z)函数图像如图所示:


因此,令x1和x2分别为0和1,可得如下表达式:


从上图中,我们可以发现x1和x2呈现出逻辑关系中的与(AND)。


同理,我们可得如下结果:


由上图可知,x1和x2呈现出逻辑关系中的或(OR)。

补充笔记
Examples and Intuitions I

A simple example of applying neural networks is by predicting x1 AND x2, which is the logical 'and' operator and is only true if both x1 and x2 are 1.

The graph of our functions will look like:


Remember that x0 is our bias variable and is always 1.

Let's set our first theta matrix as:


This will cause the output of our hypothesis to only be positive if both x1 and x2 are 1. In other words:


So we have constructed one of the fundamental operations in computers by using a small neural network rather than using an actual AND gate. Neural networks can also be used to simulate all the other logical gates. The following is an example of the logical operator 'OR', meaning either x1 is true or x2 is true, or both:


Where g(z) is the following:


示例二

与之前同理,我们可得如下结果:


由上图可知,x1呈现出逻辑关系中的非(NOT)。

我们综上所述可推得,当且仅当x1 = x2 = 0时,(NOT x1) AND (NOT x2)为1。


利用上图中三种逻辑关系,构建异或非逻辑关系的神经网络模型。

其神经网络模型如下图所示:


其结果为:


补充笔记
Examples and Intuitions II

The Θ(1) matrices for AND, NOR, and OR are:


We can combine these to get the XNOR logical operator (which gives 1 if x1 and x2 are both 0 or both 1).


For the transition between the first and second layer, we'll use a Θ(1) matrix that combines the values for AND and NOR:


For the transition between the second and third layer, we'll use a Θ(2) matrix that uses the value for OR:


Let's write out the values for all our nodes:


And there we have the XNOR operator using a hidden layer with two nodes! The following summarizes the above algorithm:


多类别分类问题

若我们要构建一个神经网络模型来识别图中的路人、汽车、摩托车和卡车,那么其模型在输出层应该有4个激活单元,其中我们用0和1分别表示不是和是。


Question:
Suppose you have a multi-class classification problem with 10 classes. Your neural network has 3 layer, and the hidden layer (layer 2) has 5 units. Using the one-vs-all method described here, how many elements does Θ(2) have?
A. 50
B. 55
C. 60
D. 65

根据神经网络:表达(二)一文中的数学公式,以及多类别分类问题的特性,我们不难选出C这个正确答案。

补充笔记
Multiclass Classification

To classify data into multiple classes, we let our hypothesis function return a vector of values. Say we wanted to classify our data into one of four categories. We will use the following example to see how this classification is done. This algorithm takes as input an image and classifies it accordingly:


We can define our set of resulting classes as y:


Each y(i) represents a different image corresponding to either a car, pedestrian, truck, or motorcycle. The inner layers, each provide us with some new information which leads to our final hypothesis function. The setup looks like:


Our resulting hypothesis for one set of inputs may look like:


In which case our resulting class is the third one down, or hΘ(x)3, which represents the motorcycle.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值