Given a 2 dimensional matrix, I'd like to compute the corresponding covariance matrix.
Are there any methods included with Nd4j that would facilitate this operation?
For example, the covariance matrix computed from the following matrix
1 2
8 12
constructed using Nd4j here:
INDArray array1 = Nd4j.zeros(2, 2);
array1.putScalar(0, 0, 1);
array1.putScalar(0, 1, 2);
array1.putScalar(1, 0, 8);
array1.putScalar(1, 1, 12);
should be
24.5 35.0
35.0 50.0
This can easily be done using pandas' DataFrame's cov
method like so:
>>> pandas.DataFrame([[1, 2],[8, 12]]).cov()
0 1
0 24.5 35.0
1 35.0 50.0
Is there any way of doing this using Nd4j?