我正在从事一个处理大型数据矩阵的项目。当我尝试将其标准化以进行计算时,出现错误
operator - is undefined for argument types double[]
我的代码如下:
import Jama.*;
public static Matrix normalize(Matrix ip_matrix, double[][] min_bound, double[][] max_bound)
{
Matrix mat = ip_matrix.transpose();
double[][] mat1 = mat.getArray(); // getting matrix as an array to perfom the computation.
int nb_input = mat1[0].length;
double[][] norm = new double[mat1[0].length][mat1[1].length]; // Initialize a default array to store the output, in the required dimension.
for (int i = 0; i <= nb_input; i++)
{
norm[i] = (mat1[i] - min_bound[i] / (max_bound[i] - min_bound[i])); //The line where i get the error.
}
norm = norm.getMatrix();
return norm;
}
我基本上是一名 Python 程序员,并且相同的逻辑在我的 Python 代码中运行良好。我在 python 中使用 numpy。并在 java 中使用 JAMA 库。
我只是java的初学者,所以请任何指导都会受到高度赞赏。