Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d1a29ce

Browse files
code update
1 parent ff0c622 commit d1a29ce

16 files changed

+1044
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Biological and Artificial Neurons"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"Before going ahead, first, we will explore what are neurons and how neurons in our brain\n",
15+
"actually work, and then we will learn about artificial neurons.\n",
16+
"\n",
17+
"A neuron can be defined as the basic computational unit of the human brain. Neurons are\n",
18+
"the fundamental units of our brain and nervous system. Our brain encompasses\n",
19+
"approximately 100 billion neurons. Each and every neuron is connected to one another\n",
20+
"through a structure called a synapse, which is accountable for receiving input from the\n",
21+
"external environment, sensory organs for sending motor instructions to our muscles, and\n",
22+
"for performing other activities.\n",
23+
"\n",
24+
"A neuron can also receive inputs from the other neurons through a branchlike structure\n",
25+
"called a dendrite. These inputs are strengthened or weakened; that is, they are weighted\n",
26+
"according to their importance and then they are summed together in the cell body called\n",
27+
"the soma. From the cell body, these summed inputs are processed and move through the\n",
28+
"axons and are sent to the other neurons.\n",
29+
"\n",
30+
"The basic single biological neuron is shown in the following diagram:\n",
31+
"\n",
32+
"![images](images/3.png)\n",
33+
"\n",
34+
"Now, let's see how artificial neurons work. Let's suppose we have three inputs $x_1,ドル $x_2,ドル and $x_3$\n",
35+
"to predict output $y$. These inputs are multiplied by weights $w_1,ドル $w_2,ドル and $w_3$ are\n",
36+
"summed together as follows: \n",
37+
"\n",
38+
"\n",
39+
"$$x_{1} \\cdot w_{1}+x_{2} \\cdot w_{2}+x_{3} \\cdot w_{3}$$"
40+
]
41+
},
42+
{
43+
"cell_type": "markdown",
44+
"metadata": {},
45+
"source": [
46+
"But why are we multiplying these inputs by weights? Because all of the inputs are not\n",
47+
"equally important in calculating the output $y$. Let's say that $x_2$ is more important in\n",
48+
"calculating the output compared to the other two inputs. Then, we assign a higher value to $w_2$\n",
49+
"than the other two weights. So, upon multiplying weights with inputs, $x_2$ will have a\n",
50+
"higher value than the other two inputs. In simple terms, weights are used for strengthening\n",
51+
"the inputs. After multiplying inputs with the weights, we sum them together and we add a\n",
52+
"value called bias, $b$ : \n",
53+
"\n",
54+
"\n",
55+
"\n",
56+
"$$ z=\\left(x_{1} \\cdot w_{1}+x_{2} \\cdot w_{2}+x_{3} \\cdot w_{3}\\right)+b$$ \n",
57+
"\n",
58+
"\n",
59+
"If you look at the preceding equation closely, it may look familiar? Doesn't $z$ look like the\n",
60+
"equation of linear regression? Isn't it just the equation of a straight line? We know that the\n",
61+
"equation of a straight line is given as: \n",
62+
"\n",
63+
"$$ z=m x+b$$\n",
64+
"\n",
65+
"\n",
66+
"\n",
67+
"Here $m$ is the weights (coefficients), $x$ is the input, and $b$ is the bias (intercept).\n",
68+
"\n",
69+
"\n",
70+
"Well, yes. Then, what is the difference between neurons and linear regression? In neurons,\n",
71+
"we introduce non-linearity to the result, $z,ドル by applying a function $f(\\cdot)$ called the activation\n",
72+
"or transfer function. Thus, our output becomes:\n",
73+
"\n",
74+
"\n",
75+
"$$y=f(z)$$\n",
76+
"\n",
77+
"\n",
78+
"A single artificial neuron is shown in the following diagram:\n",
79+
"\n",
80+
"![images](images/4.jpg)\n",
81+
"\n",
82+
"\n",
83+
"So, a neuron takes the input, x, multiples it by weights, w, and adds bias, b, forms $z,ドル and\n",
84+
"then we apply the activation function on $z$ and get the output, $y$. \n",
85+
"\n",
86+
"\n",
87+
"\n",
88+
"\n"
89+
]
90+
}
91+
],
92+
"metadata": {
93+
"kernelspec": {
94+
"display_name": "Python [conda env:anaconda]",
95+
"language": "python",
96+
"name": "conda-env-anaconda-py"
97+
},
98+
"language_info": {
99+
"codemirror_mode": {
100+
"name": "ipython",
101+
"version": 2
102+
},
103+
"file_extension": ".py",
104+
"mimetype": "text/x-python",
105+
"name": "python",
106+
"nbconvert_exporter": "python",
107+
"pygments_lexer": "ipython2",
108+
"version": "2.7.11"
109+
}
110+
},
111+
"nbformat": 4,
112+
"nbformat_minor": 2
113+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# ANN and its layers\n",
8+
"\n",
9+
"While neurons are really cool, we cannot just use a single neuron to perform complex tasks.\n",
10+
"This is the reason our brain has billions of neurons, stacked in layers, forming a network.\n",
11+
"Similarly, artificial neurons are arranged in layers. Each and every layer will be connected\n",
12+
"in such a way that information is passed from one layer to another.\n",
13+
"\n",
14+
"A typical ANN consists of the following layers:\n",
15+
"\n",
16+
"* Input layer\n",
17+
"* Hidden layer\n",
18+
"* Output layer\n",
19+
"\n",
20+
"Each layer has a collection of neurons, and the neurons in one layer interact with all the\n",
21+
"neurons in the other layers. However, neurons in the same layer will not interact with one\n",
22+
"another. This is simply because neurons from the adjacent layers have connections or edges\n",
23+
"between them; however, neurons in the same layer do not have any connections. We use\n",
24+
"the term nodes or units to represent the neurons in the artificial neural network. A typical ANN is shown in the following diagram:\n",
25+
"\n",
26+
"![images](images/5.png)\n",
27+
"\n",
28+
"## Input layer\n",
29+
"\n",
30+
"The input layer is where we feed input to the network. The number of neurons in the input\n",
31+
"layer is the number of inputs we feed to the network. Each input will have some influence\n",
32+
"on predicting the output. However, no computation is performed in the input layer; it is\n",
33+
"just used for passing information from the outside world to the network.\n",
34+
"\n",
35+
"## Hidden layer\n",
36+
"\n",
37+
"Any layer between the input layer and the output layer is called a hidden layer. It\n",
38+
"processes the input received from the input layer. The hidden layer is responsible for\n",
39+
"deriving complex relationships between input and output. That is, the hidden layer\n",
40+
"identifies the pattern in the dataset. It is majorly responsible for learning the data\n",
41+
"representation and for extracting the features.\n",
42+
"\n",
43+
"There can be any number of hidden layers; however, we have to choose a number of\n",
44+
"hidden layers according to our use case. For a very simple problem, we can just use one\n",
45+
"hidden layer, but while performing complex tasks such as image recognition, we use many\n",
46+
"hidden layers, where each layer is responsible for extracting important features. The\n",
47+
"network is called a deep neural network when we have many hidden layers. \n",
48+
"\n",
49+
"\n",
50+
"## Output layer\n",
51+
"\n",
52+
"After processing the input, the hidden layer sends its result to the output layer. As the\n",
53+
"name suggests, the output layer emits the output. The number of neurons in the output\n",
54+
"layer is based on the type of problem we want our network to solve.\n",
55+
"If it is a binary classification, then the number of neurons in the output layer is one that tells\n",
56+
"us which class the input belongs to. If it is a multi-class classification say, with five classes,\n",
57+
"and if we want to get the probability of each class as an output, then the number of neurons\n",
58+
"in the output layer is five, each emitting the probability. If it is a regression problem, then\n",
59+
"we have one neuron in the output layer.\n",
60+
"\n"
61+
]
62+
}
63+
],
64+
"metadata": {
65+
"kernelspec": {
66+
"display_name": "Python [conda env:anaconda]",
67+
"language": "python",
68+
"name": "conda-env-anaconda-py"
69+
},
70+
"language_info": {
71+
"codemirror_mode": {
72+
"name": "ipython",
73+
"version": 2
74+
},
75+
"file_extension": ".py",
76+
"mimetype": "text/x-python",
77+
"name": "python",
78+
"nbconvert_exporter": "python",
79+
"pygments_lexer": "ipython2",
80+
"version": "2.7.11"
81+
}
82+
},
83+
"nbformat": 4,
84+
"nbformat_minor": 2
85+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /