20 using namespace shogun;
44 for (
index_t k_idx=0; k_idx<combined->get_num_kernels(); k_idx++)
46 CKernel* subkernel=combined->get_kernel(k_idx);
47 REQUIRE(kernel,
"%s::%s(): Subkernel (%d) of current kernel is not"
59 "Only 64 bit float dense features allowed, these are \"%s\""
70 "Only 64 bit float streaming dense features allowed, these (p) "
71 "are \"%s\" and of type %d\n",
76 "Only 64 bit float streaming dense features allowed, these (q) "
77 "are \"%s\" and of type %d\n",
96 void CMMDKernelSelectionMedian::init()
107 SG_ERROR(
"%s::compute_measures(): Not implemented. Use select_kernel() "
128 for (
index_t i=0; i<num_data; ++i)
132 subset[i+num_data]=i+m;
189 for (
index_t i=0; i<dists.num_rows; ++i)
191 for (
index_t j=i+1; j<dists.num_rows; ++j)
192 dist_vec[write_idx++]=dists(i,j);
197 SG_DEBUG(
"median_distance: %f\n", median_distance);
202 SG_DEBUG(
"kernel width (shogun): %f\n", shogun_sigma);
214 "%d-th kernel is not a Gaussian but \"%s\"!\n",
get_name(), i,
221 if (distance<min_distance)
virtual const char * get_name() const =0
float distance(CJLCoverTreePoint p1, CJLCoverTreePoint p2, float64_t upper_bound)
virtual CStreamingFeatures * get_streaming_q()
virtual CKernel * get_kernel()
virtual CStreamingFeatures * get_streaming_p()
virtual CFeatures * get_streamed_features(index_t num_elements)
Base class for kernel selection for MMD-based two-sample test statistic implementations (e...
int32_t get_num_subkernels()
static float64_t median(SGVector< float64_t > values, bool modify=false, bool in_place=false)
Kernel two sample test base class. Provides an interface for performing a two-sample test using a ker...
This class implements the quadratic time Maximum Mean Statistic as described in [1]. The MMD is the distance of two probability distributions and in a RKHS .
CKernel * get_kernel(int32_t idx)
virtual EFeatureClass get_feature_class() const =0
The Combined kernel is used to combine a number of kernels into a single CombinedKernel object by lin...
The well known Gaussian kernel (swiss army knife for SVMs) computed on CDotFeatures.
virtual void remove_subset()
virtual EKernelType get_kernel_type()=0
The class Features is the base class of all feature objects.
static T min(T a, T b)
return the minimum of two integers
Streaming features are features which are used for online algorithms.
This class implements the linear time Maximum Mean Statistic as described in [1] for streaming data (...
virtual EStatisticType get_statistic_type() const =0
SGMatrix< float64_t > get_distance_matrix()
CKernelTwoSampleTest * m_mmd
virtual CFeatures * get_p_and_q()
CFeatures * create_merged_copy(CList *other)
static const float64_t MAX_REAL_NUMBER
virtual void add_subset(SGVector< index_t > subset)
virtual EFeatureType get_feature_type() const =0
static T abs(T a)
return the absolute value of a number