Netlab Training

Netlab Training

Copyright: © 2014 |Pages: 20
DOI: 10.4018/978-1-4666-6146-2.ch015


This chapter is a brief review on the Netlab toolbox that works with MATLAB software. Some of the main functions are introduced and examples of using the Netlab toolbox are provided to support the explanation.
Chapter Preview

2 Functions

Below some of the important functions in Netlab are introduced and explained in details followed by examples. In addition, Appendices D and E are two more dataset (Cancer and ENT) provided as an exercise to classify the datasets.

  • 1.

    Datread Function:Purpose - Read data from an ascii file. Synopsis: [x, t, nin, nout, ndata] = datread(filename). Description: [x, t, nin, nout, ndata] = datread(filename) reads from the file filename and returns a matrix x of input vectors, a matrix t of target vectors, and integers nin, nout and ndata specifying the number of inputs, the number of outputs and the number of data points respectively.

The format of the data file is as follows: the first row contains the string nin followed by the number of inputs, the second row contains the string nout followed by the number of outputs, and the third row contains the string ndata followed by the number of data vectors. Subsequent lines each contain one input vector followed by one output vector, with individual values separated by spaces.

  • 2.

    mlp Function:Purpose - Create a 2-layer feedforward network. Synopsis:

net = mlp(nin, nhidden, nout, func)
net = mlp(nin, nhidden, nout, func, prior)
net = mlp(nin, nhidden, nout, func, prior, beta)

Description: net = mlp(nin, nhidden, nout, func) takes the number of inputs, hidden units and output units for a 2-layer feed-forward network, together with a string func which specifies the output unit activation function, and returns a data structure net. The weights are drawn from a zero mean, unit variance isotropic Gaussian, with varianced scaled by the fan-in of the hidden or output units as appropriate. This makes use of the Matlab function randn and so the seed for the random weight initialization can be set using randn('state', s) where s is the seed value. The hidden units use the tanh activation function.

The fields in net are:

  • type = 'mlp.'

  • nin = Number of inputs.

  • nhidden = Number of hidden units.

  • nout = Number of outputs.

  • nwts = Total number of weights and biases.

  • actfn = String describing the output unit activation function:

    • o


    • o


    • o


  • w1 = First-layer weight matrix.

  • b1 = First-layer bias vector.

  • w2 = Second-layer weight matrix.

  • b2 = Second-layer bias vector.

Here w1 has dimensions nin times nhidden, b1 has dimensions 1 times nhidden, w2 has dimensions nhidden times nout, and b2 has dimensions 1 times nout.

Complete Chapter List

Search this Book: