Aplikasi Teknologi Cerdas
Neural Network Practical : MATLAB programming
1. Neuron Output
FIGURE 1 A SINGLE-INPUT NEURON
p : Input vector
a : Output vector
w : Weight
b : Bias
f : Activation Function/ Transfer Function
Problem Description: Calculate the output of a simple neuron
MATLAB Code :
Result :
2. Create a Neural Network
Problem Description: Create and view custom Neural Networks
Define one sample: inputs and outputs
Define and custom network
You will get:
Define Topology and Transfer Function/ Activation Function
Configure Network
Train net and Calculate Neuron Output
Train function : “Levenberg-Marquardt”
Performance Function : “Mean Squared Error”
3. Classification of Linearly Separable Data with A Perceptron
Problem Description: Two clusters of data, belonging to two classes, are defined in a 2-dimensional input space. Classes
are linearly separable. The task is to construct a Perceptron for the classification of data
Define Input and Output Data
You will get this plot:
Create and Train Perceptron
Plot Decision Boundary
You will get:
4. Classification of 4-class Problem with A Perceptron
Problem Description: Perceptron network with 2-inputs and 2-outputs is trained to classify input vectors into 4 categories
Define Data
Prepare inputs and outputs for perceptron training
Create a perceptron
Train a perceptron
Result:
How to use trained perceptron
This p is categorized to Class B because its output y = [1 1]T, you can confirm it by looking for p’s
coordinate in the result plot.
5. Solving XOR Problem with a Multilayer Perceptron
Problem Description: 4 clusters of data (A,B,C,D) are defined in a 2-dimensional input space. (A,C) and (B,D) clusters
represent XOR classification problem. The task is to define a neural network for solving the XOR problem.
Define 4 clusters of input data
Define output coding for XOR problem
Prepare inputs and outputs for network training
Create and train a multilayer perceptron
Plot targets and network response to see how good the network learns the data
Plot Classification result for the complete input space
6. Classification of a 4-Class Problem with a Multilayer
Perceptron
Problem Description: 4 clusters of data (A,B,C,D) are defined in a 2-dimensional input space. The task is to define a neural
network for classification of arbitrary point in the 2-dimensional space into one of the classes (A,B,C,D)
Define 4 Clusters of input data
Define output coding for all 4 clusters
Prepare inputs and ouputs for network training
Create and train a multilayer perceptron
Evaluate Network performance and plot results
Plot classification result for the complete input space
Tasks:
1. Try all of the problem above
2. Try to solve another problem with at least 3 various inputs (2-dimensions). One of them should be based on 2 last
digits of your NRP. Solve It with MATLAB code.
(For Example: NRP 10311710000487 use input p = [8 7])
3. Compare all of your results in MATLAB with your manual calculations.
4. How does the training work in the neural network?