1
XOR 연산자에 대한 Elman 네트워크 교육이 중단되지 않고 수백만 회 반복됩니다. 어떤 도움을 많이 주시면 감사하겠습니다!Elman 네트워크가 중지되지 않습니다.
package org.encog.example; import org.encog.Encog; import org.encog.engine.network.activation.ActivationSigmoid; import org.encog.ml.train.MLTrain; import org.encog.neural.data.NeuralDataSet; import org.encog.neural.data.basic.BasicNeuralDataSet; import org.encog.neural.networks.BasicNetwork; import org.encog.neural.networks.training.propagation.back.Backpropagation; import org.encog.neural.pattern.ElmanPattern; public class XORRNN { // 4 row, 2 column public static double XOR_INPUT[][] = { { 0.0, 0.0 }, { 1.0, 0.0 }, { 0.0, 1.0 }, { 1.0, 1.0 } }; // 4 row, 1 column public static double XOR_IDEAL[][] = { { 0.0 }, { 1.0 }, { 1.0 }, { 0.0 } }; public static void main(String[] args) { //create Elman RNN ElmanPattern elmanPattern = new ElmanPattern(); elmanPattern.setInputNeurons(2); elmanPattern.addHiddenLayer(4); elmanPattern.setOutputNeurons(1); elmanPattern.setActivationFunction(new ActivationSigmoid()); BasicNetwork network = (BasicNetwork) elmanPattern.generate(); //read training data NeuralDataSet trainingSet = new BasicNeuralDataSet(XOR_INPUT, XOR_IDEAL); //set training method MLTrain train = new Backpropagation(network, trainingSet, 0.000001, 0.0); //training int epoch = 1; do{ train.iteration(); System.out.println("Iteration: " + epoch + ", Error: " + train.getError()); epoch ++; }while(train.getError() > 0.01); //shut down Encog.getInstance().shutdown(); } }
감사합니다. – user200340