21 using namespace Eigen;
25 MatrixXd sym_decorrelation(MatrixXd W)
27 MatrixXd K = W * W.transpose();
29 SelfAdjointEigenSolver<MatrixXd> eig;
32 return ((eig.eigenvectors() * eig.eigenvalues().cwiseSqrt().asDiagonal().inverse()) * eig.eigenvectors().transpose()) * W;
44 return alpha * (1.0 - pow(gx(x),2));
85 Map<MatrixXd> EX(X.
matrix,n,p);
92 VectorXd mean = (EX.rowwise().sum() / (
float64_t)p);
93 MatrixXd SPX = EX.colwise() - mean;
95 Eigen::JacobiSVD<MatrixXd> svd;
96 svd.compute(SPX, Eigen::ComputeThinU);
98 MatrixXd u = svd.matrixU();
99 MatrixXd d = svd.singularValues();
106 for (
int r = 0; r < K.rows(); r++)
124 for (
int i = 0; i < m; i++)
126 for (
int j = 0; j < m; j++)
133 W = sym_decorrelation(W);
139 MatrixXd wtx = W * WX;
141 MatrixXd gwtx = wtx.unaryExpr(std::ptr_fun(&gx));
142 MatrixXd g_wtx = wtx.unaryExpr(std::ptr_fun(&g_x));
144 MatrixXd W1 = (gwtx * WX.transpose()) / (
float64_t)p - (g_wtx.rowwise().sum()/(
float64_t)p).asDiagonal() * W;
146 W1 = sym_decorrelation(W1);
148 lim = ((W1 * W.transpose()).diagonal().cwiseAbs().array() - 1).abs().maxCoeff();
167 #endif // HAVE_EIGEN3
static float64_t randn_double()
virtual CFeatures * apply(CFeatures *features)
all of classes and functions are contained in the shogun namespace
class ICAConverter Base class for ICA algorithms
static float64_t tanh(float64_t x)
atan2(x), x being a complex128_t not implemented
The class Features is the base class of all feature objects.
SGMatrix< float64_t > m_mixing_matrix
void set_whiten(bool whiten)
static float32_t sqrt(float32_t x)
x^0.5