13.1 The Biological Neural System
13.2 The Artificial Neural Network Model
Symbol | Meaning |
---|---|
f
| Neuron output function |
\(+\)
| Sum of the inputs |
\(x_i\)
| Inputs |
\(y_i\)
| Outputs |
\(w_{i}\)
| Weights for the inputs |
1 | Constant input of value 1 |
-
The artificial neuron in Fig. 13.3b has an additional input \(x_2\). Assign weights \(w_0\), \(w_1\), \(w_2\) so that y is 1 only if the values of \(x_1\) or \(x_2\) (or both) are 1. This implements the logic gate for or.
-
Assign weights \(w_0\), \(w_1\), \(w_2\) so that y is 1 only if the values of \(x_1\) and \(x_2\) are both 1. This implements the logic gate for and.
-
Implement the artificial neurons for logic gates on your robot. Use two sensors, one for \(x_1\) and one for \(x_2\). Use the output y (mapped by f, if necessary) so that an output of 0 gives one behavior and an output of 1 another behavior, such as turning a light on or off, or starting and stopping the robot.
-
Implement the artificial neuron shown in Fig. 13.2a so that it demonstrates the following behavior. The input to the neuron will be the reading of a proximity sensor at the front of the robot. The output will be one or both of the following: (1) the intensity of a light on the robot or the volume of the sound from a speaker on the robot; (2) the motor power applied to both the left and right motors so that the robot retreats from an object detected by the sensor.
-
The output value will be proportional to the input value: the closer the object, the greater the intensity (or volume); the closer the object, the faster the robot retreats from the object.
-
Modify the implementation so that there are two inputs from two proximity sensors (Fig. 13.2b). Give different values to the two weights \(w_1\), \(w_2\) and show that the sensor connected to the input with the larger weight has more effect on the output.
13.3 Implementing a Braintenberg Vehicle with an ANN
Specification (obstacle avoidance):The robot has three forward-facing sensors.
The robot moves forwards unless it detects an obstacle. If the obstacle is detected by the center sensor, the robot moves slowly backwards. If the obstacle is detected by the left sensor, the robot turns right. If the obstacle is detected by the right sensor, the robot turns left.
-
What relation must hold between \(w_{\textit{fwd}}\) and \(w_{\textit{back}}\)?
-
What relation must hold between \(w_{\textit{fwd}}\) and \(w_{\textit{pos}}\) and between \(w_{\textit{fwd}}\) and \(w_{\textit{neg}}\)?
-
What relation must hold between \(w_{\textit{back}}\) and \(w_{\textit{pos}}\) and between \(w_{\textit{back}}\) and \(w_{\textit{neg}}\)?
-
What relation must hold between \(w_{\textit{pos}}\) and \(w_{\textit{neg}}\)?
-
What happens if the obstacle is detected by both the left and center sensors?
-
Write a program for obstacle avoidance using the ANN in Fig. 13.4.
-
Write a program to implement obstacle attraction using an ANN:
-
The robot moves forwards.
-
If the center sensor detects that the robot is very close to the obstacle, it stops.
-
If an obstacle is detected by the left sensor, the robot turns left.
-
If an obstacle is detected by the right sensor, the robot turns right.
-
13.4 Artificial Neural Networks: Topologies
13.4.1 Multilayer Topology
-
The goal of this activity is to understand how multilayer ANNs can perform computations that a single-layer ANN cannot. For the activity, assume that the inputs \(x_i\) are in the range \(-2.0\) to 2.0, the weights \(w_i\) are in the range \(-1.0\) to 1.0, and the functions f limit the output values to the range \(-1.0\) to 1.0.
-
For the ANN consisting of a single neuron (Fig. 13.2a) with \(w_1=-0.5\), compute \(y_1\) for inputs in increments of 0.2: \(x_1=-2.0,\) \(-1.8, \ldots , 0.0, \ldots , 1.8, 2.0\). Plot the results in a graph.
-
Repeat the computation for several values of \(w_1\). What can you say about the relationship between the output and the input?
-
Consider the two-layer ANN shown in Fig. 13.7 with weights:Compute the values and draw graphs of the outputs of the neurons of the hidden layer (the left neurons) and the output layer (the right neuron). Can you obtain the same output from an ANN with only one layer?$$ w_{11}=1,\, w_{12}=0.5,\, w_{21}=1,\, w_{22}=-1\,. $$
-
Design an ANN that implements the following behavior of a robot: There are two front sensors. When an object is detected in front of one of the sensors, the robot turns to avoid the object, but when an object is detected by both sensors, the robot moves backwards.
13.4.2 Memory
-
Consider the network in Fig. 13.6b with an output function that saturates to 0 and 1. The inputs and most weights are also between 0 and 1. What happens if the weight of the recurrent connections in the figure is higher than 1? What happens if it is between 0 and 1?
-
Modify the implementation of the network in Fig. 13.4 to add recurrent connections on the two output neurons. What is their effect in the obstacle-avoidance behavior of the robot?
13.4.3 Spatial Filter
-
Implement the ANN for spatial filtering in Fig. 13.8.
-
The inputs to the ANN are the readings of five proximity sensors facing forwards. If only one sensor detects an object, the robot turns to face the object. If the center sensor is the one that detects the object, the robot moves forwards.
-
Implement three behaviors of the robot when it detects a wall defined as all five sensors detecting an object:
-
The robot stops.
-
The robot moves forwards.
-
The robot moves backwards.
Remember that there are no if-statements in an artificial neural network; you can only add additional neurons or change the weights associated with the inputs of the neurons. Look again at Activity 13.7 which used two levels of neurons to implement a similar behavior. -
-
The implementation will involve adding two additional neurons whose inputs are the outputs of the first layer. The output of the first neuron will set the power setting of the left motor and the output of the second neuron will set the power setting of the right motor.
-
What happens if an object is detected by two adjacent sensors?
13.5 Learning
13.5.1 Categories of Learning Algorithms
-
Supervised learning is applicable when we know what output is expected for a set of inputs. The error between the desired and the actual outputs is used to correct the weights in order to reduce the error. Why is it necessary to train a network if we already know how it should behave? One reason is that the network is required to provide outputs in situations for which it was not trained. If the weights are adjusted so that the network behaves correctly on known inputs, it is reasonable to assume that its behavior will be more or less correct on other inputs. A second reason for training a network is to simplify the learning process: rather than directly relate the outputs \(\{y_i\}\) to specific values of the inputs \(\{x_i\}\), it is easier to place the network in several different situations and to tell it which outputs are expected in each situation.
-
In reinforcement learning we do not specify the exact output value in each situation; instead, we simply tell the network if the output it computes is good or not. Reinforcement is appropriate when we can easily distinguish correct behavior from incorrect behavior, but we don’t really care what the exact output is for each situation. In the next section, we present reinforcement learning for obstacle avoidance by a robot; for this task it is sufficient that the robot avoid the obstacle and we don’t care what motor settings are output by the network as long as the behavior is correct.
-
Unsupervised learning is learning without external feedback, where the network adapts to a large number of inputs. Unsupervised learning is not appropriate for achieving specified goals; instead, it is used in classification problems where the network is presented with raw data and attempts to find trends within the data. This approach to learning is the topic of Chap. 14.
13.5.2 The Hebbian Rule for Learning in ANNs
-
The robot is exploring its environment, encountering various situations, each with its own inputs for which the network computes a set of outputs.
-
The robot receives information on which behaviors are good and which are not.
+
/+ separate corresponding events and actions.
-
Implement Algorithms 13.1–13.3 and teach your robot to avoid obstacles.
-
Modify the program so that it learns to move forwards when it does not detect an obstacle.