SHOGUN  v3.2.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 
MMDKernelSelectionCombMaxL2.cpp
浏览该文件的文档.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2013 Heiko Strathmann
8  */
9 
14 
15 
16 using namespace shogun;
17 
20 {
21 }
22 
25 {
26  /* currently, this method is only developed for the linear time MMD */
28  mmd->get_statistic_type()==S_LINEAR_TIME_MMD, "%s::%s(): Only "
29  "CLinearTimeMMD is currently supported! Provided instance is "
30  "\"%s\"\n", get_name(), get_name(), mmd->get_name());
31 }
32 
34 {
35 }
36 
37 #ifdef HAVE_LAPACK
39 {
40  /* cast is safe due to assertion in constructor */
42  index_t num_kernels=kernel->get_num_subkernels();
43  SG_UNREF(kernel);
44 
45  /* compute mmds for all underlying kernels and create identity matrix Q
46  * (see NIPS paper) */
48 
49  /* free matrix by hand since it is static */
50  SG_FREE(m_Q.matrix);
51  m_Q.matrix=NULL;
52  m_Q.num_rows=0;
53  m_Q.num_cols=0;
54  m_Q=SGMatrix<float64_t>(num_kernels, num_kernels, false);
55  for (index_t i=0; i<num_kernels; ++i)
56  {
57  for (index_t j=0; j<num_kernels; ++j)
58  m_Q(i, j)=i==j ? 1 : 0;
59  }
60 
61  /* solve the generated problem */
63 
64  /* free matrix by hand since it is static (again) */
65  SG_FREE(m_Q.matrix);
66  m_Q.matrix=NULL;
67  m_Q.num_rows=0;
68  m_Q.num_cols=0;
69 
70  return result;
71 }
72 #endif
CKernelTwoSampleTestStatistic * m_mmd
static SGMatrix< float64_t > m_Q
int32_t index_t
Definition: common.h:60
#define SG_UNREF(x)
Definition: SGRefObject.h:35
virtual SGVector< float64_t > solve_optimization(SGVector< float64_t > mmds)
#define REQUIRE(x,...)
Definition: SGIO.h:208
index_t num_cols
Definition: SGMatrix.h:303
index_t num_rows
Definition: SGMatrix.h:301
virtual const char * get_name() const =0
virtual SGVector< float64_t > compute_measures()
The Combined kernel is used to combine a number of kernels into a single CombinedKernel object by lin...
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:16
Two sample test base class. Provides an interface for performing a two-sample test, i.e. Given samples from two distributions and , the null-hypothesis is: , the alternative hypothesis: .
virtual SGVector< float64_t > compute_statistic(bool multiple_kernels)=0
Base class for kernel selection of combined kernels. Given an MMD instance whose underlying kernel is...
virtual EStatisticType get_statistic_type() const =0

SHOGUN Machine Learning Toolbox - Documentation