Witam.
Jestem nowy na forum więc witam się ze wszystkimi. Mam problem z biblioteką Encog. Zaprogramowałem prostą sieć neuronową. Jednak jak chce skompilować tą sieć zwykłym poleceniem javac NN.java konsola sypie takimi błedami:
==================================================================================================================================
C:\Users\Bartuś\Desktop\encog-java-core-master\encog-java-core-master\src\main\j
ava>javac NN.java
NN.java:68: error: illegal start of expression
public final void saveToDrectory("C:\\Users\\Bartuś\\Pulpit\\NN
.eg", network);
^
NN.java:68: error: ';' expected
public final void saveToDrectory("C:\\Users\\Bartuś\\Pulpit\\NN
.eg", network);
^
NN.java:68: error: not a statement
public final void saveToDrectory("C:\\Users\\Bartuś\\Pulpit\\NN
.eg", network);
^
NN.java:68: error: ';' expected
public final void saveToDrectory("C:\\Users\\Bartuś\\Pulpit\\NN
.eg", network);
^
4 errors
C:\Users\Bartuś\Desktop\encog-java-core-master\encog-java-core-master\src\main\j
ava>
==================================================================================================================================
Nie wiem w czym problem. Czy w bibliotece czy w kodzie.
Oto kod źródłowy sieci neuronowej:
import java.lang.Object;
import org.encog.Encog;
import org.encog.engine.network.activation.ActivationTAHN;
import org.encog.ml.data.MLData;
import org.encog.ml.data.MLDataPair;
import org.encog.ml.data.MLDataSet;
import org.encog.ml.data.basic.BasicMLDataSet;
import org.encog.neural.networks.BasicNetwork;
import org.encog.neural.networks.layers.BasicLayer;
import org.encog.neural.networks.training.propagation.resilient.ResilientPropagation;
import org.encog.persist.EncogDirectoryPersistence;
public class NeuralNetwork {
public static void main(final String args[]) {
// create a neural network, without using a factory
BasicNetwork network = new BasicNetwork();
network.addLayer(new BasicLayer(new ActivationTAHN(),false,10000));
network.addLayer(new BasicLayer(new ActivationTAHN(),true,8000));
network.addLayer(new BasicLayer(new ActivationTAHN(),true,6000));
network.addLayer(new BasicLayer(new ActivationTAHN(),true,4000));
network.addLayer(new BasicLayer(new ActivationTAHN(),true,2000));
network.addLayer(new BasicLayer(new ActivationTAHN(),true,1000));
network.addLayer(new BasicLayer(new ActivationTAHN(),true,800));
network.addLayer(new BasicLayer(new ActivationTAHN(),true,600));
network.addLayer(new BasicLayer(new ActivationTAHN(),true,400));
network.addLayer(new BasicLayer(new ActivationTAHN(),true,200));
network.addLayer(new BasicLayer(new ActivationTAHN(),true,100));
network.getStructure().finalizeStructure();
network.reset();
// Loading Data Set
MLDataSet trainingSet = getDataSet("C:\\Users\\Bartuś\\Pulpit\\TrainingData.csv");
// Training Neural Network
final ResilientPropagation train = new ResilientPropagation(network, trainingSet);
int epoch = 1;
do {
train.iteration();
System.out.println("Epoch #" + epoch + " Error:" + train.getError());
epoch++;
} while(train.getError() > 0.00000000001);
train.finishTraining();
// Testing Neural Network
System.out.println("Neural Network Results:");
for(MLDataPair pair: trainingSet ) {
final MLData output = network.compute(pair.getInput());
System.out.println(pair.getInput().getData(0) + "," + pair.getInput().getData(1)
+ ", actual=" + output.getData(0) + ",ideal=" + pair.getIdeal().getData(0));
}
public final void saveToDrectory("C:\\Users\\Bartuś\\Pulpit\\NN.eg", network);
Encog.getInstance().shutdown();
}
}
W załączniku są pliki biblioteki Encog. Może trzeba tą bibliotekę jakoś skompilować czy w inny sposób przygotować.
W miarę możliwości proszę o szybką odpowiedź. Z góry dziękuję.