40 #include <shogun/lib/external/libqp.h> 
   74     SG_DEBUG(
"computing MMD values for current kernel!\n");
 
   97     for (
index_t i=0; i<num_this_run; ++i)
 
   98         current[i]=pp[i]+qq[i]-pq[i]-qp[i];
 
  118         bool multiple_kernels)
 
  129             "multiple kernels specified, but underlying kernel is not of type " 
  140     if (multiple_kernels)
 
  143         SG_DEBUG(
"computing MMD and variance for %d sub-kernels\n",
 
  156             "statistic vector size (%d) does not match number of kernels (%d)\n",
 
  157              statistic.
vlen, num_kernels);
 
  160             "variance vector size (%d) does not match number of kernels (%d)\n",
 
  161              variance.
vlen, num_kernels);
 
  175     index_t num_examples_processed=0;
 
  176     while (num_examples_processed<m_2)
 
  181         SG_DEBUG(
"processing %d more examples. %d so far processed. Blocksize " 
  182                 "is %d\n", num_this_run, num_examples_processed, 
m_blocksize);
 
  191         if (multiple_kernels)
 
  192             SG_DEBUG(
"using multiple kernels\n");
 
  196         for (
index_t i=0; i<num_kernels; ++i)
 
  199             if (multiple_kernels)
 
  209             for (
index_t j=0; j<num_this_run; ++j)
 
  212                 delta=current[j]-statistic[i];
 
  213                 statistic[i]+=delta/term_counters[i]++;
 
  214                 variance[i]+=delta*(current[j]-statistic[i]);
 
  216                 SG_DEBUG(
"burst: current=%f, delta=%f, statistic=%f, " 
  217                         "variance=%f, kernel_idx=%d\n", current[j], delta,
 
  218                         statistic[i], variance[i], i);
 
  221             if (multiple_kernels)
 
  229         num_examples_processed+=num_this_run;
 
  231     SG_DEBUG(
"Done compouting statistic, processed 2*%d examples.\n",
 
  232             num_examples_processed);
 
  241     for (
index_t i=0; i<num_kernels; ++i)
 
  242         variance[i]=variance[i]/(m_2-1)/m_2;
 
  262             "underlying kernel is not of type K_COMBINED\n");
 
  274     index_t num_kernels=combined->get_num_subkernels();
 
  275     REQUIRE(num_kernels>0, 
"At least one kernel is needed\n");
 
  286             "statistic vector size (%d) does not match number of kernels (%d)\n",
 
  287              statistic.
vlen, num_kernels);
 
  290             "Q number of rows does (%d) not match number of kernels (%d)\n",
 
  294             "Q number of columns (%d) does not match number of kernels (%d)\n",
 
  305     for (
index_t k_idx=0; k_idx<combined->get_num_kernels(); k_idx++)
 
  307         CKernel* kernel = combined->get_kernel(k_idx);
 
  319     index_t num_examples_processed=0;
 
  320     while (num_examples_processed<m_4)
 
  325         SG_DEBUG(
"processing %d more examples. %d so far processed. Blocksize " 
  326                 "is %d\n", num_this_run, num_examples_processed, 
m_blocksize);
 
  374         for (
index_t i=0; i<num_kernels; ++i)
 
  404                 for (
index_t it=0; it<num_this_run; ++it)
 
  407                     term=(h_i_a[it]-h_i_b[it])*(h_j_a[it]-h_j_b[it]);
 
  412                     Q(i, j)+=(term-Q(i, j))/term_counters_Q(i, j)++;
 
  425             for (
index_t it=0; it<num_this_run; ++it)
 
  429                 statistic[i]=statistic[i]+
 
  430                         (h_i_a[it]-statistic[i])/term_counters_statistic[i]++;
 
  433                 statistic[i]=statistic[i]+
 
  434                         (h_i_b[it]-statistic[i])/(term_counters_statistic[i]++);
 
  446         num_examples_processed+=num_this_run;
 
  453     SG_DEBUG(
"Done compouting statistic, processed 4*%d examples.\n",
 
  454             num_examples_processed);
 
virtual bool init(CFeatures *lhs, CFeatures *rhs)
CSGObject * get_next_element()
virtual void compute_statistic_and_Q(SGVector< float64_t > &statistic, SGMatrix< float64_t > &Q)
void display_vector(const char *name="vector", const char *prefix="") const 
CStreamingFeatures * m_streaming_q
CSGObject * get_first_element()
virtual void compute_statistic_and_variance(SGVector< float64_t > &statistic, SGVector< float64_t > &variance, bool multiple_kernels=false)
Abstract base class that provides an interface for performing kernel two-sample test on streaming dat...
virtual ~CLinearTimeMMD()
virtual SGVector< float64_t > compute_squared_mmd(CKernel *kernel, CList *data, index_t num_this_run)
int32_t get_num_elements()
The Combined kernel is used to combine a number of kernels into a single CombinedKernel object by lin...
EMessageType get_loglevel() const 
all of classes and functions are contained in the shogun namespace 
virtual EKernelType get_kernel_type()=0
The class Features is the base class of all feature objects. 
bool append_element(CSGObject *data)
Streaming features are features which are used for online algorithms. 
SGVector< float64_t > get_kernel_diagonal(SGVector< float64_t > preallocated=SGVector< float64_t >())
CStreamingFeatures * m_streaming_p
CList * stream_data_blocks(index_t num_blocks, index_t num_this_run)
void set_const(T const_elem)
void set_const(T const_elem)
Class List implements a doubly connected list for low-level-objects.