Wednesday, September 10, 2014

Performing classification using back propagation network in Scilab

The following steps must be followed

Enable ANN Toolbox under Data Analysis and Statistics in ATOMS

Sample code

in1 = csvRead('D:\siva\02-sep-14\sonar-all-data.csv');
in2 =csvRead('D:\siva\02-sep-14\sonar-result.csv');
x=in1';
t=in2';
rand('seed',0);
N = [60,30,30,30,1];
//N is neural network with 60 node input layer 3 hidden layer with 30 node each and 1 node output //layer
//lp is learning parameter with 0.5 learning rate and 0 error threshold
lp = [0.5, 0];
W = ann_FF_init(N);
//T no of epochs
T = 300;
//disp(x);
//disp(t);
W = ann_FF_Std_online(x,t,N,W,lp,T);
p=ann_FF_run(x,N,W);
o=round(p);
plot(t,'.r');
plot(o,'.g')

The file sonar-all-data.csv contain the features and sonar-result.csv contain the expected result.
The data classify material into rock and metal based on the features.
The files can be downloaded from
sonar-all-data.csv
sonar-result.csv
sample output