42 using namespace Eigen;
58 "Only equal number of samples from both the distributions are "
59 "possible. Provided %d samples from p and %d samples from q!\n",
72 SG_ADD(&m_num_features,
"num_features",
73 "Number of features from each of the distributions",
75 SG_ADD(&m_epsilon,
"epsilon",
"The regularization constant",
88 REQUIRE(
m_p,
"Provided feature for p cannot be null!\n");
95 REQUIRE(
m_q,
"Provided feature for q cannot be null!\n");
113 const index_t n=m_num_features;
118 MatrixXd to_inv=mat+n*m_epsilon*MatrixXd::Identity(n,n);
123 LLT<MatrixXd> chol(to_inv);
126 VectorXd e=VectorXd::Zero(n);
132 const VectorXd& x=chol.solve(e);
133 #pragma omp parallel for shared (res, mat, x, i)
138 res(j,i)=x.dot(mat.col(j));
153 "set the kernel for use!\n");
155 "set the kernel for use!\n");
176 for (
index_t i=0; i<m_num_features; ++i)
181 result+=Rx_map.col(i).dot(Ry_map.col(i));
201 SG_ERROR(
"Use only PERMUTATION for null-approximation method "
220 SG_ERROR(
"Use only PERMUTATION for null-approximation method "
270 #endif // HAVE_EIGEN3
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)
static const float64_t epsilon
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)