41 using namespace Eigen;
57 "Only equal number of samples from both the distributions are "
58 "possible. Provided %d samples from p and %d samples from q!\n",
71 SG_ADD(&m_num_features,
"num_features",
72 "Number of features from each of the distributions",
74 SG_ADD(&m_epsilon,
"epsilon",
"The regularization constant",
87 REQUIRE(
m_p,
"Provided feature for p cannot be null!\n");
94 REQUIRE(
m_q,
"Provided feature for q cannot be null!\n");
112 const index_t n=m_num_features;
117 MatrixXd to_inv=mat+n*m_epsilon*MatrixXd::Identity(n,n);
122 LLT<MatrixXd> chol(to_inv);
125 VectorXd e=VectorXd::Zero(n);
131 const VectorXd& x=chol.solve(e);
132 #pragma omp parallel for shared (res, mat, x, i)
137 res(j,i)=x.dot(mat.col(j));
152 "set the kernel for use!\n");
154 "set the kernel for use!\n");
175 for (
index_t i=0; i<m_num_features; ++i)
180 result+=Rx_map.col(i).dot(Ry_map.col(i));
200 SG_ERROR(
"Use only PERMUTATION for null-approximation method "
219 SG_ERROR(
"Use only PERMUTATION for null-approximation method "
virtual bool init(CFeatures *lhs, CFeatures *rhs)
virtual float64_t compute_p_value(float64_t statistic)
virtual float64_t compute_statistic()
virtual float64_t compute_p_value(float64_t statistic)
The Custom Kernel allows for custom user provided kernel matrices.
SGMatrix< float64_t > get_kernel_matrix_L()
SGMatrix< float64_t > compute_helper(SGMatrix< float64_t > m)
virtual SGVector< float64_t > sample_null()
virtual int32_t get_num_vectors() const =0
float64_t get_epsilon() const
virtual void set_p(CFeatures *p)
virtual void set_p(CFeatures *p)
virtual float64_t compute_threshold(float64_t alpha)
SGMatrix< float64_t > get_kernel_matrix_K()
void set_epsilon(float64_t epsilon)
virtual float64_t compute_threshold(float64_t alpha)
all of classes and functions are contained in the shogun namespace
The class Features is the base class of all feature objects.
ENullApproximationMethod m_null_approximation_method
Kernel independence test base class. Provides an interface for performing an independence test...
virtual SGVector< float64_t > sample_null()
virtual void set_q(CFeatures *q)
virtual void set_q(CFeatures *q)