16 REQUIRE(W.rows() == W.cols(),
"amari_index - W must be square\n")
17 REQUIRE(A.rows() == A.cols(),
"amari_index - A must be square\n")
18 REQUIRE(W.rows() == A.rows(),
"amari_index - A and W must be the same size\n")
19 REQUIRE(W.rows() >= 2,
"amari_index - input must be at least 2x2\n")
24 for (
int r = 0; r < W.rows(); r++)
27 if (W.row(r).maxCoeff() < -1*W.row(r).minCoeff())
32 for (
int r = 0; r < A.rows(); r++)
35 if (A.row(r).maxCoeff() < -1*A.row(r).minCoeff())
44 for (
int j = 1; j < A.cols(); j++)
46 if (A(0,j) < A(0,j-1))
48 A.col(j).swap(A.col(j-1));
62 for (
int r = 0; r < k; r++)
63 E1.row(r) = P.row(r) / P.row(r).maxCoeff();
65 float64_t row_error = (E1.rowwise().sum().array()-1).sum();
68 for (
int c = 0; c < k; c++)
69 E2.col(c) = P.col(c) / P.col(c).maxCoeff();
71 float64_t col_error = (E2.colwise().sum().array()-1).sum();
73 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