Desktop Survival Guide
by Graham Williams

Tutorial Example

The nnet package provides algorithms for feed-forward neural networks with a single hidden layer, and for multinomial log-linear models.

> library(nnet)
> ?nnet		# See example there

Consider a two-class problem. Build a neural network with


The Rarg[]linout= argument ensures the model predicts a linear value, rather than a logistic value.

The average Matthew Correlation Coeffience can be used to gauge the performance of the neural network. The highr the value the better.

For an unbalanced class, for example where the ratio of class A to class B is about 3:100, we might decide to weight the under-represented class:

> sample.nn <- nnet(....... weights=ifelse(ds$class=="A", 100/3, 1)

Note that we must do any scaling of continuous before using nnet since it is not done inside nnet (unlike ksvm).

Copyright © Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010