Calculate covariance matrix in Java

I want to compute the covariance matrix using Java.

Is there a free library for computing the covariance matrix in Java?

+7
source share
3 answers

The Apache Commons Math library can do this.

+6
source

Here is a quick example of how you can create it using Apache Commons Math (3.5):

RealMatrix mx = MatrixUtils.createRealMatrix(new double[][]{ {1, 2, 3}, {2, 4, 6} }); RealMatrix cov = new Covariance(mx).getCovarianceMatrix(); 
+6
source
0
source

All Articles