so, i have been attempting to create a neural network in processing, but after i get the error: ArrayIndexOutOfBoundException: Index 0, Size:0, i can not think of any way that this is caused
ArrayList<Float>generateNodes(int layer,int nodes) {
// generates IndexOutOfBounds ArrayList[] layers=new ArrayList[layer+1];
// same error as line 70 ArrayList[] layers={new ArrayList<ArrayList<Float>>(),new ArrayList<ArrayList<Float>>(),new ArrayList<ArrayList<Float>>()};
ArrayList<ArrayList<Float>> layers=new ArrayList<ArrayList<Float>>();
ArrayList<ArrayList<Float>> InternalNodes=new ArrayList<ArrayList<Float>>();
if(layer==1) {
for(int l=0; l<=inputs.length-1; l++) {
layers.add(new ArrayList<Float>(Arrays.asList(node(inputs[l],weights.get(l)))));
}
}
else {
for(int n=0; n<=nodes; n++) {
layers.add(new ArrayList<Float>(Arrays.asList(node(InternalNodes.get(layer-1).get(n),weights.get(weights.size()-1)))));
}
}
return layers.get(layers.size()-1);
}
}