我是机器学习的新手,并且正在开发一个Java应用程序,该程序使用其图像对对象进行分类.我有40个输入神经元和n个输出神经元(取决于训练数据的数量).我将Encog用作神经网络的框架.我能够成功训练数据,但是在测试网络时,它似乎无法正常运行.它无法正确分类对象.
这是用于训练的部分:
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();
和测试部分:
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));
}
训练部分有问题吗?我确实希望有人以正确的方式指导我.