diff --git a/src/main/java/net/echo/brain4j/model/impl/FeedForwardModel.java b/src/main/java/net/echo/brain4j/model/impl/FeedForwardModel.java index a6b5c34..fee9824 100644 --- a/src/main/java/net/echo/brain4j/model/impl/FeedForwardModel.java +++ b/src/main/java/net/echo/brain4j/model/impl/FeedForwardModel.java @@ -90,7 +90,7 @@ public double fit(DataSet set) { @Override public double[] predict(double ... input) { - Layer inputLayer = layers.getFirst(); + Layer inputLayer = layers.get(0); if (input.length != inputLayer.getNeurons().size()) { throw new IllegalArgumentException("Input size does not match model's input dimension!"); @@ -129,7 +129,7 @@ public double[] predict(double ... input) { nextLayer.applyFunction(); } - Layer outputLayer = layers.getLast(); + Layer outputLayer = layers.get(layers.size() - 1); double[] output = new double[outputLayer.getNeurons().size()]; for (int i = 0; i < output.length; i++) { diff --git a/src/main/java/net/echo/brain4j/training/BackPropagation.java b/src/main/java/net/echo/brain4j/training/BackPropagation.java index b403c8b..3e80294 100644 --- a/src/main/java/net/echo/brain4j/training/BackPropagation.java +++ b/src/main/java/net/echo/brain4j/training/BackPropagation.java @@ -73,7 +73,7 @@ private void backpropagate(double[] targets, double[] outputs, double learningRa } private void initialDelta(List layers, double[] targets, double[] outputs) { - Layer outputLayer = layers.getLast(); + Layer outputLayer = layers.get(layers.size() - 1); for (int i = 0; i < outputLayer.getNeurons().size(); i++) { Neuron neuron = outputLayer.getNeuronAt(i);