15 REQUIRE(W.rows() == W.cols(),
"amari_index - W must be square\n")
16 REQUIRE(A.rows() == A.cols(),
"amari_index - A must be square\n")
17 REQUIRE(W.rows() == A.rows(),
"amari_index - A and W must be the same size\n")
18 REQUIRE(W.rows() >= 2,
"amari_index - input must be at least 2x2\n")
23 for (
int r = 0; r < W.rows(); r++)
26 if (W.row(r).maxCoeff() < -1*W.row(r).minCoeff())
31 for (
int r = 0; r < A.rows(); r++)
34 if (A.row(r).maxCoeff() < -1*A.row(r).minCoeff())
43 for (
int j = 1; j < A.cols(); j++)
45 if (A(0,j) < A(0,j-1))
47 A.col(j).swap(A.col(j-1));
61 for (
int r = 0; r < k; r++)
62 E1.row(r) = P.row(r) / P.row(r).maxCoeff();
64 float64_t row_error = (E1.rowwise().sum().array()-1).sum();
67 for (
int c = 0; c < k; c++)
68 E2.col(c) = P.col(c) / P.col(c).maxCoeff();
70 float64_t col_error = (E2.colwise().sum().array()-1).sum();
72 return 1.0 / (float)(2*k*(k-1)) * (row_error + col_error);
float64_t amari_index(SGMatrix< float64_t > SGW, SGMatrix< float64_t > SGA, bool standardize)
function amari_index
all of classes and functions are contained in the shogun namespace