0% found this document useful (0 votes)
206 views3 pages

NN Tool Example

This document provides instructions for using Matlab to build a neural network to implement XOR logic. It describes importing input and output data files into the Matlab workspace, creating a neural network with the Neural Network Toolbox, training the network on the XOR data, simulating the network to test its output, and exporting the trained network. It then tasks the reader with building a neural network classifier for a bank loan problem using a similar process and notes to transpose the input matrices so rows correspond to inputs.

Uploaded by

cOrekern
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
206 views3 pages

NN Tool Example

This document provides instructions for using Matlab to build a neural network to implement XOR logic. It describes importing input and output data files into the Matlab workspace, creating a neural network with the Neural Network Toolbox, training the network on the XOR data, simulating the network to test its output, and exporting the trained network. It then tasks the reader with building a neural network classifier for a bank loan problem using a similar process and notes to transpose the input matrices so rows correspond to inputs.

Uploaded by

cOrekern
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2011/2012 G51IAI Lab Session

Exercise: Implementing XOR in Matlab


1. To be able to work in Matlab, youll first need to store in your workspace the data variables
required for your application. Matlab can receive data in different format, including text file,
and MS Excel file.
To build your input and output files in text files:
In your Input file, save
0011
0101
In your output file, save
0110
X1
X2
Y

0
0
0

0
1
1

1
0
1

1
1
0

Click File/Import Data to import your input and output data, one at a time, from you local
drive. After this youll see the matrix of your variables under Workspace.
2. To begin using the ANN Tool in Matlab, you can either a) click Start/Toolboxes/Neural
Network/Neural Network Tool, or b) type nntool in the Commend Window.
In the below Network/Data Manager window (it may be slightly different depends on the
version of your Matlab), you can input the data into the Workspace of Matlab, which can then
be used by your ANN.

Click Import, select the data file you wish as the input to your ANN. Under Destination, make
sure the Input Data button is selected. Again, select the data file you wish as the output to
your ANN. Under Destination, make sure the Target Data button is selected.
3. Click New to create your ANN.

2011/2012 G51IAI Lab Session


The Create Network or Data window is where you can set up and configure your ANN, i.e.
type of network, number of neurons at different layers, training function, etc.
Name your ANN as XOR, or whatever name you prefer. Select the Input data as XORinput
and Target data as XORoutput. At the moment, leave all the other settings as default.

Click Create to create your ANN.


4. In the Network/Data Manager window, double click your ANN.
You can view the ANN you just created. Under Train/Training Data select the Inputs and
Targets.
You can view the settings of the training parameters under Training Parameters. At the
moment, leave them as default.
Click Train Network.
5. After the training is complete, click the Simulate tab to see the result of the output.
Under Simulate, choose the input XORinput, and click Simulate Network. Go back to the
Network/Data Manager window, double click XOR_output under Output Data. Check and
compare the output with your expected output of XOR.
6. Click Export in the Network/Data Manager window to export your ANN.
Choose and output the variables youd like to keep. After this you should be able to see them
in your workspace.
7. Use/experiment your ANN.
Type sim(XOR, [1; 0]) to simulate the result of inputting [1;0] to your ANN. Enter. Check and
compare the result with the true table of XOR.
Try a different input by typing sim(XOR, [?; ?]) and compare the result with the true table of
XOR.
8.

If you save your ANN as a .mat file, youll be able to use it in your C++ or C#. This is out of
the scope of this module but feel free to explore the possibilities!

2011/2012 G51IAI Lab Session


Task: Build an ANN for the Bankloan Problem
Download the bankloan spreadsheets from the modules web page. Build an ANN to learn to
classify the customers.
Notes:
-

You should follow the above same steps building the XOR network

After the data files are imported into the Matlab workspace, the matrix should be
transposed so that rows of the matrix correspond to the inputs to the ANN.
The command is:
Name_of_you_input_variable = Name_of_you_input_variable
Name_of_you_output_variable = Name_of_you_output_variable

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy