NeuralNetwork copied in Java from 10.6


#1

I’m using Java & Processing
Hey I’m trying to follow 10.6: Neural Networks: Matrix Math Part 1 - The Nature of Code, but got stuck where he makes each matrix[i] its own array. I couldnt figure out if in java it be float[] matrix[i], which didnt work or matrix[i] = []. which dont work or if there another way to do as he did but in java.
here where I got so far in my java version yes it dont work;

class Matrix{
  float rows, cols;
  Matrix(float rows, float cols){
    this.rows = rows;
    this.cols = cols;
    float[] matrix;// here I'm suppose to make a new array I think I have
    for (int i = 0; i < rows; i++){
      float [] matrix[i]; here I need to make a new array for each i, the error pops up IDK how to fix it. 
    }
  }
}

#2

2D float array: :nerd_face:

class Matrix {
  final float[][] matrix;

  Matrix(final int rows, final int cols) {
    matrix = new float[rows][cols];
  }
}

#3

tyvm, what final int mean?


#4

https://Processing.org/reference/final.html


#5

Ive done the topic about NNs in Processing. Look for it above yours.
However Matrix stuff works correctly, back propogation algorithm has some problems there