[译]AI:面向初学者的神经网络(第1部分,共3部分)
By robot-v1.0
本文链接 https://www.kyfws.com/ai/ai-neural-network-for-beginners-part-of-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 12 分钟阅读 - 5765 个词 阅读量 0AI:面向初学者的神经网络(第1部分,共3部分)(译文)
原文地址:https://www.codeproject.com/Articles/16419/AI-Neural-Network-for-beginners-Part-of
原文作者:Sacha Barber
译文由本站 robot-v1.0 翻译
前言
AI : An introduction into Neural Networks
AI:神经网络简介
介绍(Introduction)
本文是我将要发布的三篇文章系列的第1部分.拟议的文章内容如下:(This article is Part 1 of a series of 3 articles that I am going to post. The proposed article content will be as follows:)
- 第1部分:本部分将介绍Perceptron网络(单层神经网络)(Part 1: This one, will be an introduction into Perceptron networks (single layer neural networks))
- 第2部分(Part 2) :将涉及多层神经网络,以及用于解决非线性分类问题(例如XOR逻辑门的逻辑)的反向传播训练方法.这是Perceptron无法做到的.本文将对此进行进一步说明(: Will be about multi layer neural networks, and the back propogation training method to solve a non-linear classification problem such as the logic of an XOR logic gate. This is something that a Perceptron can’t do. This is explained further within this article)
- 第三部分(Part 3) :有关如何使用遗传算法(GA)训练多层神经网络以解决某些逻辑问题的知识:(: Will be about how to use a genetic algorithm (GA) to train a multi layer neural network to solve some logic problem)
让我们从生物学开始(Let’s start with some biology)
大脑中的神经细胞称为神经元.人脑中的power(1013)神经元估计有1010.每个神经元可以与数千个其他神经元接触.神经元是大脑用来处理信息的单位.(Nerve cells in the brain are called neurons. There is an estimated 1010 to the power(1013) neurons in the human brain. Each neuron can make contact with several thousand other neurons. Neurons are the unit which the brain uses to process information.)
那么神经元是什么样的(So what does a neuron look like)
神经元由细胞体组成,并具有多种延伸形式.其中大多数是称为树枝状的树枝.轴突是一个更长的过程(可能还会分支).虚线显示了轴突岗,信号的传输开始于此(A neuron consists of a cell body, with various extensions from it. Most of these are branches called dendrites. There is one much longer process (possibly also branching) called the axon. The dashed line shows the axon hillock, where transmission of signals starts)
下图说明了这一点.(The following diagram illustrates this.)
图1神经元(Figure 1 Neuron)
神经元的边界称为细胞膜.膜的内部和外部之间存在电压差(膜电位).(The boundary of the neuron is known as the cell membrane. There is a voltage difference (the membrane potential) between the inside and outside of the membrane.)
如果输入足够大,则将产生一个动作电位.然后,动作电位(神经突峰)沿轴突向下移动,远离细胞体.(If the input is large enough, an action potential is then generated. The action potential (neuronal spike) then travels down the axon, away from the cell body.)
图2神经元加标(Figure 2 Neuron Spiking)
突触(Synapses)
一个神经元与另一个神经元之间的连接称为突触.信息总是通过其轴突离开神经元(请参见上面的图1),然后通过突触传输到接收神经元.(The connections between one neuron and another are called synapses. Information always leaves a neuron via its axon (see Figure 1 above), and is then transmitted across a synapse to the receiving neuron.)
神经元射击(Neuron Firing)
只有输入大于某个阈值时,神经元才会触发.但是,应该注意的是,随着刺激的增加,射击不会变大,这是一种全有或全无的安排.(Neurons only fire when input is bigger than some threshold. It should, however, be noted that firing doesn’t get bigger as the stimulus increases, its an all or nothing arrangement.)
图3神经元射击(Figure 3 Neuron Firing)
尖峰(信号)很重要,因为其他神经元会收到它们.神经元与尖峰沟通.发送的信息由尖峰编码.(Spikes (signals) are important, since other neurons receive them. Neurons communicate with spikes. The information sent is coded by spikes.)
神经元的输入(The input to a Neuron)
突触可以是兴奋性的或抑制性的.(Synapses can be excitatory or inhibitory.)
到达兴奋性突触的尖峰(信号)往往会引起接收神经元放电.到达抑制性突触的尖峰(信号)往往会抑制接收神经元的发射.(Spikes (signals) arriving at an excitatory synapse tend to cause the receiving neuron to fire. Spikes (signals) arriving at an inhibitory synapse tend to inhibit the receiving neuron from firing.)
细胞体和突触本质上(通过复杂的化学/电过程)计算传入的兴奋性和抑制性输入(空间和时间总和)之间的差异.(The cell body and synapses essentially compute (by a complicated chemical/electrical process) the difference between the incoming excitatory and inhibitory inputs (spatial and temporal summation).)
当此差异足够大(与神经元的阈值相比)时,神经元将触发.(When this difference is large enough (compared to the neuron’s threshold) then the neuron will fire.)
粗略地说,兴奋性尖峰到达其突触的速度越快,它的发射速度就越快(对于抑制性尖峰也是如此).(Roughly speaking, the faster excitatory spikes arrive at its synapses the faster it will fire (similarly for inhibitory spikes).)
那么人工神经网络怎么样(So how about artificial neural networks)
假设我们每个神经元都有一个放电率.还假设神经元与(Suppose that we have a firing rate at each neuron. Also suppose that a neuron connects with)米(m)其他神经元,因此收到m个很多输入" x1….…xm",我们可以想象这种配置看起来像:(other neurons and so receives m-many inputs “x1 …. … xm”, we could imagine this configuration looking something like:)
图4人工神经元配置(Figure 4 Artificial Neuron configuration)
此配置实际上称为(This configuration is actually called a)感知器(Perceptron).感知器(Rosenblatt的一项发明[1962])是最早的神经网络模型之一.感知器通过获取输入的加权总和并发送输出1来模拟神经元,如果总和大于某个可调整的阈值(否则它发送0-这是生物学中描述的全部或不加标,请参见神经元触发部分)以上)也称为激活功能.(. The perceptron (an invention of Rosenblatt [1962]), was one of the earliest neural network models. A perceptron models a neuron by taking a weighted sum of inputs and sending the output 1, if the sum is greater than some adjustable threshold value (otherwise it sends 0 - this is the all or nothing spiking described in the biology, see neuron firing section above) also called an activation function.)
输入(The inputs)(x1,x2,x3..xm)((x1,x2,x3..xm))和连接权重(and connection weights)(w1,w2,w3..wm)((w1,w2,w3..wm))图4中的典型值是正数,正数(+)和负数(-).如果功能有些(in Figure 4 are typically real values, both postive (+) and negative (-). If the feature of some)xi(xi)容易引起感知器着火,重量(tends to cause the perceptron to fire, the weight)无线(wi)将是积极的;如果功能(will be positive; if the feature)xi(xi)抑制感知器,重量(inhibits the perceptron, the weight)无线(wi)将是负面的.(will be negative.)
感知器本身由权重,求和处理器,激活函数以及可调整的阈值处理器(以下称为"偏置")组成.(The perceptron itself, consists of weights, the summation processor, and an activation function, and an adjustable threshold processor (called bias here after).)
为了方便起见,通常的做法是将偏差视为另一种输入.下图说明了修改后的配置.(For convenience the normal practice is to treat the bias, as just another input. The following diagram illustrates the revised configuration.)
图5人工神经元配置,带有偏置作为附加输入(Figure 5 Artificial Neuron configuration, with bias as additinal input)
偏差可以认为是感知器着火的倾向(一种特定行为方式的倾向),无论其输入如何.如果加权总和> 0,或者您正在进行数学类型的解释,则会触发图5中所示的感知器配置网络(The bias can be thought of as the propensity (a tendency towards a particular way of behaving) of the perceptron to fire irrespective of its inputs. The perceptron configuration network shown in Figure 5 fires if the weighted sum > 0, or if you’re into math-type explanations)
激活功能(Activation Function)
激活通常使用以下功能之一.(The activation usually uses one of the following functions.)
乙状结肠功能(Sigmoid Function)
输入越强,神经元发射速度越快(发射速率越高).乙状结肠在多层网络中也非常有用,因为乙状结肠曲线允许差异化(这在多层网络的反向传播训练中是必需的).(The stronger the input, the faster the neuron fires (the higher the firing rates). The sigmoid is also very useful in multi-layer networks, as the sigmoid curve allows for differentation (which is required in Back Propogation training of multi layer networks).)
或者如果您进入数学类型说明(or if your into maths type explanations)
步进功能(Step Function)
基本的开/关类型函数,如果0> x,则为0,否则,如果x> =0,则为1(A basic on/off type function, if 0 > x then 0, else if x >= 0 then 1)
或者如果您进入数学类型的解释(or if your into math-type explanations)
学习(Learning)
学习前言(A foreword on learning)
在继续谈论感知器学习之前,让我们考虑一个真实的例子:(Before we carry on to talk about perceptron learning lets consider a real world example :)
您如何教孩子识别椅子?您给他展示一些例子,告诉他:“这是一把椅子.那不是椅子.“直到孩子学习了椅子的概念.在这个阶段,孩子可以看一下我们给他看的例子,并在被问到"这个物体是椅子吗?“时正确回答.(How do you teach a child to recognize a chair? You show him examples, telling him, “This is a chair. That is not a chair,” until the child learns the concept of what a chair is. In this stage, the child can look at the examples we have shown him and answer correctly when asked, “Is this object a chair?")
此外,如果我们向孩子展示他以前从未见过的新物体,我们可以期望他正确识别新物体是否是椅子,只要我们给他足够的正面和负面的例子.(Furthermore, if we show to the child new objects that he hasn’t seen before, we could expect him to recognize correctly whether the new object is a chair or not, providing that we’ve given him enough positive and negative examples.)
这正是感知器背后的想法.(This is exactly the idea behind the perceptron.)
在感知器中学习(Learning in perceptrons)
是修改权重和偏差的过程.感知器计算其输入的二进制函数.感知器可以计算的任何东西都可以学习计算.(Is the process of modifying the weights and the bias. A perceptron computes a binary function of its input. Whatever a perceptron can compute it can learn to compute.)
“(")感知器是一个学习概念的程序,即它可以通过反复"研究"呈现给它的示例来学习对我们呈现给它的输入使用True(1)或False(0)做出响应.(The perceptron is a program that learn concepts, i.e. it can learn to respond with True (1) or False (0) for inputs we present to it, by repeatedly “studying” examples presented to it.)
感知器是一个单层神经网络,当与相应的输入向量一起显示时,可以训练其权重和偏差以产生正确的目标向量.所使用的训练技术称为感知器学习规则.感知器由于能够从其训练向量进行概括并能够与随机分布的连接一起工作而引起了极大的兴趣.感知器特别适合模式分类中的简单问题.(The Perceptron is a single layer neural network whose weights and biases could be trained to produce a correct target vector when presented with the corresponding input vector. The training technique used is called the perceptron learning rule. The perceptron generated great interest due to its ability to generalize from its training vectors and work with randomly distributed connections. Perceptrons are especially suited for simple problems in pattern classification.)"(")
冯建峰教授,英国沃里克大学科学计算中心.(Professor Jianfeng feng, Centre for Scientific Computing, Warwick university, England.)
学习规则(The Learning Rule)
训练感知器以对每个输入向量做出响应,以对应的目标输出0或1进行学习.事实证明,如果存在解,则学习规则可以在有限时间内收敛于解.(The perceptron is trained to respond to each input vector with a corresponding target output of either 0 or 1. The learning rule has been proven to converge on a solution in finite time if a solution exists.)
学习规则可以归纳为以下两个方程式:(The learning rule can be summarized in the following two equations:)
b =b + [T-A](b = b + [ T - A ])
对于所有输入i:(For all inputs i:)
W(i)=W(i)+ [T-A] * P(i)(W(i) = W(i) + [ T - A ] * P(i))
哪里(Where)w ^(W)是权重的向量,(is the vector of weights,)P(P)是呈现给网络的输入向量,(is the input vector presented to the network,)是神经元应该显示的正确结果,(is the correct result that the neuron should have shown,)一种(A)是神经元的实际输出,并且(is the actual output of the neuron, and)b(b)是偏见.(is the bias.)
训练(Training)
来自训练集的向量一个接一个地呈现给网络.(Vectors from a training set are presented to the network one after another.)
如果网络输出正确,则不会进行任何更改.(If the network’s output is correct, no change is made.)
否则,将使用感知器学习规则来更新权重和偏差(如上所示).当训练集的每个历元(贯穿所有输入训练向量的整个历程称为历元)无误地发生时,训练就完成了.(Otherwise, the weights and biases are updated using the perceptron learning rule (as shown above). When each epoch (an entire pass through all of the input training vectors is called an epoch) of the training set has occured without error, training is complete.)
此时,任何输入训练向量都可以呈现给网络,并且它将以正确的输出向量进行响应.如果是向量(At this time any input training vector may be presented to the network and it will respond with the correct output vector. If a vector,)P(P),而不是将训练集中的信息呈现给网络,则网络将倾向于通过响应类似于目标向量的输出来响应接近于先前看不见的输入向量的输入向量,从而表现出一般性(, not in the training set is presented to the network, the network will tend to exhibit generalization by responding with an output similar to target vectors for input vectors close to the previously unseen input vector)P(P).(.)
那我们可以用神经网络做什么(So what can we use do with neural networks)
好吧,如果我们要坚持使用单层神经网络,则可以实现的任务与多层神经网络可以实现的任务不同.由于本文主要针对单层网络,因此让我们进一步探讨一下:(Well if we are going to stick to using a single layer neural network, the tasks that can be achieved are different from those that can be achieved by multi-layer neural networks. As this article is mainly geared towards dealing with single layer networks, let’s dicuss those further:)
单层神经网络(Single layer neural networks)
单层神经网络(感知器网络)是输出单元彼此独立的网络-每个权重仅影响一个输出.使用感知器网络,可以实现线性可分离性功能,如下图所示(假设我们有一个2输入1输出的网络)(Single-layer neural networks (perceptron networks) are networks in which the output unit is independent of the others - each weight effects only one output. Using perceptron networks it is possible to achieve linear seperability functions like the diagrams shown below (assuming we have a network with 2 inputs and 1 output))
可以看出,这等效于AND/OR逻辑门,如下所示.(It can be seen that this is equivalent to the AND / OR logic gates, shown below.)
图6分类任务(Figure 6 Classification tasks)
因此,这是一个简单的示例,说明我们可以使用一个感知器(本质上是单个神经元)做什么,但是如果我们要将多个感知器链接在一起怎么办?我们可以构建一些非常复杂的功能.基本上,我们将构建等效的电子电路.(So that’s a simple example of what we could do with one perceptron (single neuron essentially), but what if we were to chain several perceptrons together? We could build some quite complex functionality. Basically we would be constructing the equivalent of an electronic circuit.)
但是,感知器网络确实有局限性.如果向量不是线性可分离的,则学习将永远不会达到对所有向量进行正确分类的程度.感知器无法解决线性不可分向量的问题的最著名示例是布尔XOR问题.(Perceptron networks do however, have limitations. If the vectors are not linearly separable, learning will never reach a point where all vectors are classified properly. The most famous example of the perceptron’s inability to solve problems with linearly nonseparable vectors is the boolean XOR problem.)
多层神经网络(Multi layer neural networks)
使用多层神经网络,我们可以解决非线性可分离问题,例如上述的XOR问题,这是使用单层(感知器)网络无法实现的.本系列文章的下一部分将展示如何使用反向传播训练方法,使用多层神经网络来执行此操作.(With muti-layer neural networks we can solve non-linear seperable problems such as the XOR problem mentioned above, which is not acheivable using single layer (perceptron) networks. The next part of this article series will show how to do this using muti-layer neural networks, using the back propogation training method.)
好吧,这就是本文.我希望它对神经网络有一个很好的介绍.当我有空闲时间时(在MSc发行与其他工作之间),我将尝试发布其他两篇文章.我希望它们能很漂亮地显示出来,所以可能要花我一段时间,但我保证很快就会到达那里.(Well that’s about it for this article. I hope it’s a nice introduction to neural networks. I will try and publish the other two articles when I have some spare time (in between MSc disseration and other assignments). I want them to be pretty graphical so it may take me a while, but i’ll get there soon, I promise.)
你怎么看 ?(What Do You Think ?)
就是这样,我想问一下,如果您喜欢这篇文章,请投赞成票.(Thats it, I would just like to ask, if you liked the article please vote for it.)
兴趣点(Points of Interest)
我认为AI相当有趣,这就是为什么我要花时间发布这些文章的原因.因此,我希望其他人会发现它有趣,并且因为它具有我自己的知识,因此可能会有助于进一步提高人们的知识.(I think AI is fairly interesting, that’s why I am taking the time to publish these articles. So I hope someone else finds it interesting, and that it might help further someones knowledge, as it has my own.)
历史(History)
v1.0 17/11/06(v1.0 17/11/06)
参考书目(Bibliography)
人工智能第二版,伊莱恩里奇/凯文
奈特.麦格劳`希尔公司(Artificial Intelligence 2nd edition, Elaine Rich / Kevin Knight. McGraw Hill Inc.)
人工智能,一种现代方法,Stuart Russell/Peter Norvig.学徒大厅.(Artificial Intelligence, A Modern Approach, Stuart Russell / Peter Norvig. Prentice Hall.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C# .NET Windows Visual-Studio Dev AI 新闻 翻译