Changed initialization of weights to gaussian distributed values and biases to 1 (this helps (Leaky)ReLu and doesn't seem hurt tanh yet)

This commit is contained in:
lluni 2022-05-25 17:26:55 +02:00
parent 281b42b0fb
commit f1ca0a9e54

View file

@ -14,11 +14,8 @@ public class FCLayer extends Layer {
}
private void initialize(int inputSize) {
Random random = new Random();
this.weights = new SimpleMatrix(inputSize, numNeurons, true,
random.doubles((long) inputSize*numNeurons, -1, 1).toArray());
this.biases = new SimpleMatrix(1, numNeurons, true,
random.doubles(numNeurons, -1, 1).toArray());
this.weights = Utilities.gaussianMatrix(inputSize, numNeurons, 0, 1, 0.1d);
this.biases = Utilities.ones(1, numNeurons);
this.isInitialized = true;
}