Using Matlab - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

Using Matlab

Description:

For each of the demos, you can try it by simply clicking on the 'run this demo' ... As a first try you can load the noted example data. ... – PowerPoint PPT presentation

Number of Views:113
Avg rating:3.0/5.0
Slides: 36
Provided by: fakp
Category:
Tags: matlab | using

less

Transcript and Presenter's Notes

Title: Using Matlab


1
Using Matlab
2
Notation/Diagrams
  • In general, the Matlab manual on neural networks
    uses the following notation scheme
  • Scalars small italic letters a,b,c
  • Vectors small bold nonitalic letters a,b,c
  • Matrices capital BOLD nonitalic letters A,B,C

3
Notation/Diagrams
4
Notation/Diagrams
5
Notation/Diagrams
6
Notation/Diagrams
7
Notation/Diagrams
8
Notation/Diagrams
9
Notation/Diagrams
10
NNs in Matlab
  • There are multiple tools in Matlab to create and
    train neural networks.
  • You will need to use the documentation and the
    help function to understand them
  • After Matlab starts, go to Help (top bar)
  • For us, the two most important links are
  • Helpgt product help
  • Helpgt demos

11
NNs in Matlab Help gt Product Help
  • You will now see a list of items for which there
    is help. You will be most interested in MATLAB
    and the Neural Network Toolbox
  • You will also be interested in the demos section
    (look at the thumb tab across the top of the
    contents window).

12
IMPORTANT NOTE
  • To get to most of the documentation in the NN
    notes, there are multiple ways. What is used
    and/or shown in these notes is only one, and
    possibly not the best way.

13
NN Demos
  • First lets demo some NN stuff in Matlab.
  • Note in Product Help at the top there is a tab
    labeled demos.
  • Scroll down to Neural Network and expand that
    section, then expand Neurons
  • To run any demo click on it and in its window in
    the upper right corner select Run this demo
  • Your first demo to run is Simple Neuron and
    Transfer Function try it

14
Note
  • For each of the demos, you can try it by simply
    clicking on the run this demo link in the upper
    right of the window.
  • OR
  • In Matlab just type the name of the demo. For
    this demo, you will see its name on the left,
    i.e nnd2n1

15
Function Reference
  • Under the Neural network Toolbox you will see a
    link to Function reference expand this and you
    will see numerous NN functions.
  • The most useful for now are the Graphical
    Interface Functions
  • Try the nntool by typing nntool in the Matlab
    command window.

16
Training several different functions
  • trainb
  • trains a network with weight and bias learning
    rules with batch updates. The weights and biases
    are updated at the end of an entire pass through
    the input data.
  • trainr
  • trains a network with weight and bias learning
    rules with incremental updates after each
    presentation of an input. Inputs are presented in
    random order.

17
Training different functions
  • trains
  • Trains a network with weight and bias learning
    rules with incremental updates after each
    presentation of an input. Inputs are presented in
    sequential order.

18
NFTOOL
  • This is used to solve fitting problems using a
    2-layer neural network.
  • In general, before starting nftool, you should
    have two matrices
  • Matrix p (name is arbitray) This is the input
    data arranged as nXm matrix. N rows X m columns
  • N of data points
  • Mdimension of input vector

19
NFTOOL
  • Matrix t (name is arbitray) this is the target
    data nX1
  • N of target outputs
  • Of the two layers, the first layer will be a set
    of K neurons (your choice) with each having a
    user selected transfer function.
  • The second layer will be a single neuron
    implementing a linear transfer function.

20
(No Transcript)
21
nftool
  • The first step is to select the data
  • As a first try you can load the noted example
    data.
  • For the next homework, the data to load is the
    functiondata on the class web site, following
    the Homework 4 link
  • gtgtpxlsread(functiondata) this will work
  • gtgttp(,3)
  • gtgtpp(,12)
  • The preceding will set up p and t correctly.

22
(No Transcript)
23
nftool
  • The box labeled shows what is on your current
    working directory.
  • The other box (a pulldown) shows what is in your
    Matlab workspace. If you used the instructions on
    slide 21 to load and create p and t, then
  • For inputs select p from the pulldown
  • For targets select t from the pulldown
  • Read the summary statement to be sure all is ok
  • Change the orientation for this data to rows

24
nftool
  • Clicking on next will give you the following
    window

25
(No Transcript)
26
nftool
  • In this window all you select is the for
    testing and for validation.
  • We will leave it at 15 for validation and 15
    for testing.
  • Remember validation is used to predict
    generalization capabilities and stopping time
  • Test data tells how good the results
  • Note also that these values are chosen randomly,
    so results may differ between runs

27
nftool
  • In the next slide you see the network and can
    select number of hidden layer neurons. The
    default is 20, you can try several different
    values to see how well the network works

28
(No Transcript)
29
nftool
  • We have selected the default for this example.
    Next gives the option in the next slide (30)
  • Selecting train will generate an overlay window
    (slide 31) showing how the training is going or
    has gone if its fast.
  • Note for more than 1-dimensional data, you
    cant plot Fit.

30
(No Transcript)
31
(No Transcript)
32
nftool
  • According to the progress report
  • The network stopped at 7 iterations
  • Time was 0
  • The mean squared error was 122
  • The gradient (slope) was at 2.87 when it stopped
  • The LM update value was 0.001
  • At the 10th epoch there had been 6 validation
    failures, i.e. performance decreased from
    training

33
nftool
  • Show Plots

34
(No Transcript)
35
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com