forked from evolvingstuff/RecurrentJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleEmbeddedReberGrammar.java
More file actions
37 lines (28 loc) · 978 Bytes
/
Copy pathExampleEmbeddedReberGrammar.java
File metadata and controls
37 lines (28 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import datasets.EmbeddedReberGrammar;
import datastructs.DataSet;
import model.Model;
import trainer.Trainer;
import util.NeuralNetworkHelper;
import java.util.Random;
public class ExampleEmbeddedReberGrammar
{
public static void main(String[] args)
throws Exception
{
Random rng = new Random();
DataSet data = new EmbeddedReberGrammar(rng);
int hiddenDimension = 12;
int hiddenLayers = 1;
double learningRate = 0.001;
double initParamsStdDev = 0.08;
Model nn = NeuralNetworkHelper.makeLstm(
data.inputDimension,
hiddenDimension, hiddenLayers,
data.outputDimension, data.getModelOutputUnitToUse(),
initParamsStdDev, rng);
int reportEveryNthEpoch = 10;
int trainingEpochs = 1000;
Trainer.train(trainingEpochs, learningRate, nn, data, reportEveryNthEpoch, rng);
System.out.println("done.");
}
}