I'm new to Machine Learning and I'm working on a a Java application that classifies an object using its image. I have 40 input neurons and n output neurons(dependent on the number of training data). I used Encog as a framework for my Neural Network. I was able to successfully train the data but as I test the network, it does not seem to work well. It cannot classify the objects correctly. Here's for the training part:
BasicNetwork network = new BasicNetwork();
network.addLayer(new BasicLayer(null,true,i));
network.addLayer(new BasicLayer(new ActivationSigmoid(),true,h));
network.addLayer(new BasicLayer(new ActivationSigmoid(),false,o));
network.getStructure().finalizeStructure();
network.reset();
// train the neural network
final Backpropagation train = new Backpropagation(network, trainingSet, lr, 0.3);
train.fixFlatSpot(false);
w = new SwingWorker(){
@Override
protected Object doInBackground() throws Exception {
// learn the training set
int epoch = 1;
do {
train.iteration();
//System.out.println("Epoch #" + epoch + " Error:" + train.getError());
epoch++;
} while(train.getError() > me && !isStop);
isStop = false;
return null;
}
};
w.execute();
and the testing part:
BasicNetwork network = (BasicNetwork) SerializeObject.load(new File("file/Weights.ser"));
MLData input = new BasicMLData(inputCount);
input.setData(in);
MLData output = network.compute(input);
for(int y = 0; y < output.size(); y++){
System.out.println(output.getData(y));
}
Is there something wrong with the training part? I do hope someone could guide me if I'm doing things the right way.