Neural network classifier using Encog

I'm new to Machine Learning and I'm working on a Java application that classifies an object using its image. I have 40 input neurons and n output neurons (depending on the amount of training data). I used Encog as the basis for my neural network. I was able to train the data successfully, but checking the network it seems that it doesn't work. He cannot classify objects correctly. Here's for the tutorial 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 tutorial part? I hope someone can guide me if I am doing everything right.

+3


source to share


1 answer


Do you mean that when you are trying to recognize the exact data that you have trained, you cannot recognize it? If so, I would guess that there is some difference in how you encode images for testing versus learning.



If you see poor results on data other than what you trained with, that's a different (and common) problem. This means that the training data may not be representative of the entire problem space. that is, the new data you are using is different from the training data, which does not match.

+3


source







All Articles