21 using namespace Eigen;
23 namespace { MatrixXd cor(MatrixXd x,
int tau = 0,
bool mean_flag =
true); };
33 m_tau[0]=0; m_tau[1]=1; m_tau[2]=2; m_tau[3]=3;
70 Map<MatrixXd> EX(X.
matrix,n,m);
79 for (
int t = 0; t < N; t++)
82 EM = cor(EX,m_tau[t]);
87 Map<MatrixXd> EQ(Q.
matrix,n,n);
95 for (
int t = 0; t < C.cols(); t++)
96 C.col(t) /= C.col(t).maxCoeff();
107 MatrixXd cor(MatrixXd x,
int tau,
bool mean_flag)
115 VectorXd mean = x.rowwise().sum();
117 x = x.colwise() - mean;
121 MatrixXd L = x.leftCols(n-tau);
122 MatrixXd R = x.rightCols(n-tau);
126 K = (L * R.transpose()) / (n-tau);
129 K = (K + K.transpose()) / 2.0;
135 #endif // HAVE_EIGEN3
virtual CFeatures * apply(CFeatures *features)
static SGMatrix< float64_t > diagonalize(SGNDArray< float64_t > C, SGMatrix< float64_t > V0=SGMatrix< float64_t >(NULL, 0, 0, false), double eps=CMath::MACHINE_EPSILON, int itermax=200)
SGNDArray< float64_t > get_covs() const
T * get_matrix(index_t matIdx) const
SGVector< float64_t > get_tau() const
void set_tau(SGVector< float64_t > tau)
static void inverse(SGMatrix< float64_t > matrix)
inverses square matrix in-place
all of classes and functions are contained in the shogun namespace
class ICAConverter Base class for ICA algorithms
The class Features is the base class of all feature objects.
SGMatrix< float64_t > m_mixing_matrix