|
@@ -14,6 +14,7 @@ from lab import generator, trainer, benchmark
|
|
|
parser = argparse.ArgumentParser(description = "Start a training session for a neuronal network and display results.")
|
|
|
parser.add_argument('-a, --alpha', help = "set the learning rate", dest="learnRate", type = float, default = 0.05)
|
|
|
parser.add_argument('-e, --epochs', help = "set the number of iterations", dest="epochs", type = int, default = 2)
|
|
|
+parser.add_argument('-n, --neurons', help = "set the number of hidden neurons", dest="hiddenNeurons", type = int, default = 30)
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
@@ -21,6 +22,7 @@ args = parser.parse_args()
|
|
|
print("Parameters")
|
|
|
print("Learning rate : ", args.learnRate)
|
|
|
print("Number of epochs : ", args.epochs)
|
|
|
+print("Number of hidden layers : ", args.hiddenNeurons)
|
|
|
|
|
|
activation = expit
|
|
|
activationDerivative = lambda x : expit(x) * (1 - expit(x))
|
|
@@ -28,7 +30,7 @@ activationDerivative = lambda x : expit(x) * (1 - expit(x))
|
|
|
# Session
|
|
|
print("Start session")
|
|
|
print("... generating neural network ...")
|
|
|
-network = generator.generate(activation, activationDerivative, generator.gaussAdaptedDev)
|
|
|
+network = generator.generate(activation, activationDerivative, hiddenLength = args.hiddenNeurons, weightGenerator = generator.gaussAdaptedDev)
|
|
|
|
|
|
print("... compute precision before training ... ")
|
|
|
precisionBefore = benchmark.computePrecision(network)
|