11
I am trying to solve this Kaggle Problem using Neural Networks. I am using Pybrain Python Library.
It's a classical supervised Learning Problem. In following code: 'data' variable is numpy array(892*8). 7 fields are my features and 1 field is my output value which can be '0' or '1'.
from pybrain.datasets import ClassificationDataSet
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.tools.shortcuts import buildNetwork
dataset = ClassificationDataSet(7,1)
for i in data:
dataset.appendLinked(i[1:],i[0])
net = buildNetwork(7,9,7,1, bias = True,hiddenclass = SigmoidLayer, outclass = TanhLayer)
trainer = BackpropTrainer(net, learningrate = 0.04, momentum = 0.96, weightdecay = 0.02, verbose = True)
trainer.trainOnDataset(dataset, 8000)
trainer.testOnData(verbose = True)
After training my Neural Network, when I am testing it on Training Data, its always giving a single output for all inputs. Like:
Testing on data:
out: [ 0.075]
correct: [ 1.000]
error: 0.42767858
out: [ 0.075]
correct: [ 0.000]
error: 0.00283875
out: [ 0.075]
correct: [ 1.000]
error: 0.42744569
out: [ 0.077]
correct: [ 1.000]
error: 0.42616996
out: [ 0.076]
correct: [ 0.000]
error: 0.00291185
out: [ 0.076]
correct: [ 1.000]
error: 0.42664586
out: [ 0.075]
correct: [ 1.000]
error: 0.42800026
out: [ 0.076]
correct: [ 1.000]
error: 0.42719380
out: [ 0.076]
correct: [ 0.000]
error: 0.00286796
out: [ 0.076]
correct: [ 0.000]
error: 0.00286642
out: [ 0.076]
correct: [ 1.000]
error: 0.42696969
out: [ 0.076]
correct: [ 0.000]
error: 0.00292401
out: [ 0.074]
correct: [ 0.000]
error: 0.00274975
out: [ 0.076]
correct: [ 0.000]
error: 0.00286129
I have tried altering learningRate, weightDecay, momentum, number of hidden units, number of hidden layers, class of h