C#人工智能(AI)编程:对神经网络面向一个基本的对象(OOP)框架

     

                                      C#人工智能(AI)编程:对神经网络面向一个基本的对象(OOP)框架

        (A Neural Network is an Artificial Intelligence (AI) methodology that attempts to mimic the behavior of the neurons in our brains.  Neural networks really shine when it comes to pattern recognition and are used in image and character recognition programs, data filtering applications, and even robotics. A neural net was even used to drive an automated vehicle across the US after learning from observing human drivers.  In this article, we'll be building a basic framework for AI Neural Networks in C# and teach our program to perform basic X-OR operations.)  神经网络是一个试图模仿我们的大脑神经元的行为的人工智能(AI)方法。在本文中,我们将建立在C#中的人工智能神经网络的基本框架,并教导我们的程序来执行基本X-OR操作.  

         神经网络是一个试图模仿我们的大脑神经元的行为的人工智能(AI)方法。当涉及到模式识别,图像和字符识别程序,数据过滤应用程序,甚至机器人均采用神经网络大放异彩。一个神经网络,甚至被用来从观察人的司机学习后开车横跨美国的自动车辆。在本文中,我们将建立在C#中的人工智能神经网络的基本框架,并教导我们的程序来执行基本X-OR操作。

             第一部分   一,概述

          (Basically, each neuron in our brain accepts input from many other neurons and then provides a resulting output.  This is precisely what we will be replicating in code.  Each neuron class will have a structure similar to diagram 1 where there is a body of attributes and one output.)基本上,在我们的大脑每一神经元接受来自许多其它神经元的输入,然后提供一个产生的输出。这正是我们将在代码中复制。每个神经元类将具有类似于图1的结构,其中有属性和一个输出的主体。

图1

         (Each neuron can have multiple inputs and the neurons will be grouped as in diagram 2.) 每个神经元可以有多个输入和神经元将被分组为在 图2:

2

      (Neurons will be grouped in layers. While processing a signal (we'll call it a "pulse"), the signal will start at the top layer flowing through and being modified by each neuron in that layer.
)   神经元将在层分组。在处理的信号(我们称之为“脉冲”),该信号将开始流经顶层和通过在该层中的每个神经元被修改。
3

       (Each neuron will modify the strength of the pulse.  After the modification has been completed, the "pulse" will travel to the next layer and be modified again.) 每个神经将修改脉冲的强度。修改已经完成之后,“脉冲”,将行进到下一层而被再次修改。

4

    (Now that you have the details, let's take a step back and see how a large number of cells create a "neural net", or a network of neurons. For a neural net to work, we need at least three groupings of neurons.)    现在,你有细节,让我们退后一步,看到大量的细胞如何建立一个“神经网络”,或神经元网络。对于神经网络的工作,我们需要的神经元中的至少三组。

图5

   (The top layer is used by the neural net to perceive the environment and is often called the "perception" or "input" layer.  This is where we will set initial values to be passed through the net with the pulse.)   顶层所使用的神经网络来感知环境和通常被称为“感知”或“输入”层。这是我们将设置为通过与脉冲净传递初始值。

6

     (The bottom later is where the neural net will expose the final output of our pulse. Notice these neurons don't send their signal anywhere.  After the pulse travels to this layer, we'll go pick up the values on the output neurons as the final output of our network's processing.)   底部后来就是神经网络会暴露我们的脉冲的最终输出。请注意,这些神经元不会在任何地方发送它们的信号。脉冲传播到这一层之后,我们会去拿起输出神经元作为我们网络的处理的最终输出的值。

7

    (Last but not least, all the neurons in the middle layer(s) process the pulse as it travels through the net but are not exposed as direct input or output of the net.  This is often called the "hidden" layer.)    最后但并非最不重要的,在中间层(多个)的所有神经元处理脉冲,因为它穿过网,但不暴露作为直接输入或净输出。这通常被称为“隐藏”层

图8

So now for the magic: making the network learn.

In order for our neural net to have the ability to learn, after our signal travels from the top of our net to the bottom, we have to update how each neuron will affect the next pulse that travels the network.  This is done by a process called back propagation.  Basically we figure out a figure representing the level of error that our network produced.  This is arrived at by comparing the expected output of the net to the actual output.


)      

   第2部分通过反向传播学习。

所以,现在的魔术:使网络学习。

为了让我们的神经网络具有学习的能力,我们的信号从我们的网底顶部的旅行之后,我们必须更新每个神经元将如何影响移动网络的下一个脉冲。这是由一种叫做反向传播过程中完成的。基本上,我们计算出代表我们的网络所产生的误差级别的人物。这是在由网的预期输出相比较的实际输出来了。

Let's say we have an error in one of the cells in the output layer.)比方说,我们在输出层的一个细胞有一个错误。

图9。

(Each neuron will keep track of the neurons sending the pulse through and adjust the importance of the output of each of these parent neurons that contributed to the final output of the error cell.)每个神经将跟踪神经元通过发送脉冲和调整每个到错误小区的最终输出促成这些父神经元的输出的重要性。

图10。

(Next, each of these neurons will have an error value calculated, and the adjustment will "back propagate", meaning that we will perform the same process to the next layer of neurons (the ones that send the pulse to our hidden layer).)接着,这些神经元将具有错误值计算的,并且该调整将“回传播”,这意味着我们将执行相同的过程的神经元(即发送脉冲给我们的隐藏层的那些)的下一层。

图11

    
概念上,这是神经网络将如何工作。一旦关于神经网络的很酷的事情是,他们通过学习这个迭代过程后得到充分的培训,就可以计算投入产出,他们从来没有遇到过,这使得它们非常适合模式识别和人工智能游戏之前。接下来,我们将开始寻找一些实际的C#接口来代表一个神经网络。

第三部分。该接口

首先,我们将建立基本的接口,然后实现它们。在开发可扩展的代码中,我们的接口可以是该项目的最关键的部分,因为他们确定实施将如何落入地方,最终我们的项目的成功。

首先,我们需要一个接口来定义通过我们的网络的神经细胞传送的信号。

public interface INeuronReceptor

{

    Dictionary<INeuronSignalNeuralFactor> Input { get; }

}

图12

我们需要一个接口来定义一个神经元,它是由许多其它神经元组成的输出的输入端。对于这一点,我们将使用一个通用的字典,其中关键是信号和输出是定义该信号的“权重”一类。

持续翻译中。。。。

受时间的印象有些部分直接翻译了英文 未对原文进行书写。可自行了解。

翻译自:http://www.c-sharpcorner.com/article/C-Sharp-artificial-intelligence-ai-programming-a-basic-object/          

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值