Linear neural network based on perceptron model _ AI

Source: Internet
Author: User
Tags rand
Summary: WithThe artificial neural network has been developed with the development of computational intelligence. The industry now considers that the classification of Neural Networks (NN) in artificial intelligence (AI) may not be appropriate, and that the classification of computational Intelligence (CI) is more descriptive of the problem. Some topics in evolutionary computing, artificial life and fuzzy logic systems are also classified as computational intelligence. Although the boundary between computational intelligence and artificial intelligence is not very obvious, it is beneficial to discuss their differences and relationships, and logical thinking refers to the process of reasoning according to logical rules, which first makes the information into concepts and symbols, then, according to the symbolic operation, the logical reasoning is based on serial mode. This process can be written as a serial instruction for the computer to execute. However, intuitive thinking is the integration of distributed storage information, resulting in a sudden idea or solution to the problem. This article is devoted to the general idea of neural network processing, but also for the computer science and technology major in the junior course "AI" the fourth algorithm experiment.
Keywords: artificial intelligence, neural network, Perceptron model

Production System

Forward along with the computing intelligence, artificial neural network has been abstract: putting. At present the industry considering the neural network (NN) classified as artificial intelligence (AI) could not appropriate , and classified as computational Intelligence (CI) more telling. Evolutionary computation, artificial life, and some issues of the fuzzy logic system, are classified as computational inte Lligence. Despite the limits of computational intelligence and artificial intelligence are not obvious, however, discuss the Differen Ce and relationship is beneficial, logical thinking refers to the process according to the rules of logic reasoning; It'll information into the concept and symbol, and then, according to the symbolic operation logic reasoning Ding to the serial mode; This process can is written as a serial of instruction, let's computer to perform. However, visual thinking is the distributed storage of information together, theSuddenly an idea or a solution to the problem. And this paper are devoted to general thoughts about neural network processing, as as so computer science and technology Under the Junior professional class "artificial intelligence" of the fourth algorithm.

Keywords: Artificial Intelligence, neural network, the Perceptron model

1, the development of neural network
In the the 1950s, Rosenblatt and others presented the Perceptron (neural network) model and formed the School of connectivity.

1.1 The connecting point of view core
The essence of intelligence is the connection mechanism, and the neural network is a highly complex large-scale nonlinear adaptive system composed of a large number of simple processing units.

1.2 Simulation of human brain intelligence behavior of the four levels
• Physical Structure
• Computational Simulations
• Storage and operation
• Training

1.3 Artificial Neural network
Neural network is a parallel and distributed information processing network. It is a direction graph which is connected with a weighted arc-joint with a processing unit as a node. The treatment unit is a simulation of the physiological neurons, while the arc is the simulation of axon-synaptic-dendritic pairs. The weight of a forward arc indicates the strength of the interaction between the two processing units. It's usually made up of a large number of neurons
• Each neuron has only one output and can connect to many other neurons
• Each neuron input has multiple connection channels, each connected channel corresponds to a connection weight factor

2. The establishment of the model

2.1 Artificial Neural network model



2.2 Basic role of response function – control input to output activation-function conversion of input and output-transforms possible infinite field input into specified finite range output





2.3 Perceptron Model

The Perceptron was proposed by the American computer scientist Rosenblatt (F.roseblatt) in 1957. Single-layer perceptron neuron model diagram:



2.4 Mathematical Models







3. Perceptron algorithm

3.1 Training Steps

1 To solve the problem, determine the input vector X, target vector T, so as to determine the dimensions and network structure parameters, n,m;

2) parameter initialization;

3) Set the maximum cycle times;

4 compute the network output;

5) Check the output vector y and the target vector T is the same, if the same, or to reach the maximum number of cycles, training ended, otherwise transferred to 6;

6) study and return 4.


3.2 Network Training

The network training process of adaptive linear elements can be summarized into the following three steps:

1) Expression: Compute the output vector of the model a=w*p 10 B, and the error e=t-a with the desired output;

2) Check: The network output error squared and compared with the expected error, if its value is less than the expected error, or training has reached the maximum number of training set beforehand, then stop training;

3 Learning: Using W-h Learning rules to calculate new weights and deviations, and return to 1.


4, the problem is introduced

4.1 Problem Description
Now consider the design of a larger network of multiple neural networks associated with patterns. The input vector and the target vector are:

p=

{

{1,-1,2},

{1.5,2,1},

{1.2,3,-1.6},

{ -0.3,-0.5,0.9}

};


t=

{

{0.5,1.1,3,-1},

{3,-1.2,0.2,0.1},

{ -2.2,1.7,-1.8,-1.0},

{1.4,-0.4,-0.4,0.6}

};

4.2 Ideas for solving problems

The input vector and the target output vector can be obtained: the input vector number r=3, the output vector number s=4, the sample number q=4.

The solution of this problem can also be solved by a linear equation group, which is to write out the relationship equation between input and output for each output node.

In fact, it takes a certain amount of time, not even easy, to ask for the solution of these 16 equations.

For some practical problems, it is often not necessary to ask for a perfect solution of the 0 error. That is to say, there is some error allowed.

In this case, the use of adaptive Linear Network solution shows its superiority: because it can quickly train to meet certain requirements of the network weights.

5, program design



#include <iostream> #include <ctime> #include <cmath> using namespace std;        const int max_learn_length = 100;            Max Learning Times Const FLOAT study_rate = 0.2;   Learning Rate Const FLOAT Anticipation_error = 0.01;     Expected error const INT input = 3;    Three input const int output = 4;    Four output const int sample = 4;
4 Group sample float P[sample][input] =//4 Group 3 entry vector {{1,-1,2}, {1.5,2,1}, {1.2,3,-1.6}, { -0.3,-0.5,0.9}}; float T[sample][output] = expected output vector {{0.5,1.1,3,-1} of//4 Group 4, {3,-1.2,0.2,0.1}, { -2.2,1.7,-1.8,-1.0}, {1.4,-0.4,-0.4,0

.6}};            int main (int argc, char **argv) {float precision;     Error precision variable float w[input][sample];            3 Item 4 Group input corresponding network weight variable float b[sample];    4 Group of threshold variables float a[sample];

	The actual output value of each group int II, IJ, IK, IC;             Srand (Time (0));   Initializes a random function for (ii = 0; ii<sample; ii++) {B[ii] = 2 * (float) rand ()/rand_max-1; Threshold variable Assign random value ( -1,1) for (ij = 0; ij<input; ij++)//Network weight variable assign random value {W[ij][ii] = 2 * (float) ranD ()/rand_max-1;         } precision = Flt_max; Initialize the precision value for (IC = 0; IC < max_learn_length; ic++)//maximum learning cycles {if (precision<anticipation_error)//Cyclic pruning letter
		number {break;
		} precision = 0; for (ii = 0; ii<sample; ii++)//4 Group sample cyclic stacking error precision {for (ij = 0; ij<output; ij++)//Calculate 4 actual output {A[ij] =
				0.0;
				for (ik = 0; ik<input; ik++) {A[ij] + = P[ii][ik] * W[ik][ij];
			} A[ij] + = B[ij]; for (ij = 0; ij<output; ij++)//adjust network weights and thresholds by learning rate {for (ik = 0; ik<input; ik++) {W[ik][ij] =
				Study_rate* (T[ii][ij]-a[ij]) *p[ii][ik];
			} B[ij] + = study_rate* (T[ii][ij]-a[ij]);
			for (ij = 0; ij<output; ij++)//Calculation error Precision {precision + = POW ((t[ii][ij)-a[ij]), 2;
	}} cout << "Max learning times:" << max_learn_length << Endl;
	cout << "The number of learning to accomplish the goal is:" << ic << Endl;
	cout << Endl << "expected error is:" << anticipation_error << Endl; cout <&Lt
	"To achieve the goal of learning after the accuracy of:" << precision <<endl<< Endl;
	cout << "After the study of the network right value is:" << Endl; for (ii = 0; ii<sample; ii++)//Output after learning Network weights {for (ij = 0; ij<input; ij++)//4 Group sample per group 3 input {cout <& Lt
		W[ii][ij] << "";
	} cout << Endl;   
 	cout <<endl<< "After learning the threshold is:" << Endl;
	for (ii = 0; ii<output; ii++)//Output threshold after learning: Four sample output {cout << b[ii] << "";
	} cout << endl<<endl;
	System ("pause");
return 0;



 }









Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.