content
1.Realize logic ‘and’
1.1precondition
我们有两个输入,分别是
&
,且他们只能取0或者1.
神经网络的模型为
同时,我们有
以及
的图形
1.2way to realize it
由函数可以看出,只要输入z(即
)大于4,就能得到1,否则就让其值小于-4.
我们赋值为
,就能得到以上结果,用一个真值表来说明
z | y | ||
---|---|---|---|
1 | 1 | 10 | 1 |
1 | 0 | -10 | 0 |
0 | 1 | -10 | 0 |
0 | 0 | -30 | 0 |
由真值表来看,我们实现了“与”逻辑。
2.Realize logic ‘or’,‘not’ and ‘notand’
2.1Realize logic ‘or’
由上面的例子,我们可以得到这样一组
来实现逻辑或。
2.2Realize logic ‘not’
y | |
---|---|
1 | 0 |
0 | 1 |
根据真值表设计
值,可以得到
2.3Realize logic ‘nand’
所谓 ‘nand’,其实是这样的逻辑, ,列出其真值表
y | ||
---|---|---|
1 | 1 | 0 |
1 | 0 | 0 |
0 | 1 | 0 |
0 | 0 | 1 |
由上述真值表我们可以得到
3.Realize logic ‘XNOR’
'XNOR’逻辑是相同为1,不同为0,可以得到真值表为
y | ||
---|---|---|
1 | 1 | 1 |
1 | 0 | 0 |
0 | 1 | 0 |
0 | 0 | 1 |
对于这样的逻辑,我们无法直接用一层网络来实现,需要用两层网络来实现,我们使用如下的神经网络
红色代表and逻辑,绿色代表Nand逻辑,蓝色代表OR逻辑。这也许代表了神经网络的学习方式,每一层学出一条特征,这些特征再通过一定的方式组合起来,在下一层中起到作用。
4.deep thinking on it
我们怎样确定每一层使用的模型?应该使用多少层?这是需要解决的问题。
下面的视频链接是用机器学习的方式来识别手写的邮政编码数字,很有意思,有条件的同学可以看一看。
https://www.youtube.com/watch?v=yxuRnBEczUU