SHOGUN  4.1.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 
38 {
39  /* cast is safe due to assertion in constructor */
41  index_t num_kernels=kernel->get_num_subkernels();
42  SG_UNREF(kernel);
43 
44  /* compute mmds for all underlying kernels and create identity matrix Q
45  * (see NIPS paper) */
47 
48  /* free matrix by hand since it is static */
49  SG_FREE(m_Q.matrix);
50  m_Q.matrix=NULL;
51  m_Q.num_rows=0;
52  m_Q.num_cols=0;
53  m_Q=SGMatrix<float64_t>(num_kernels, num_kernels, false);
54  for (index_t i=0; i<num_kernels; ++i)
55  {
56  for (index_t j=0; j<num_kernels; ++j)
57  m_Q(i, j)=i==j ? 1 : 0;
58  }
59 
60  /* solve the generated problem */
62 
63  /* free matrix by hand since it is static (again) */
64  SG_FREE(m_Q.matrix);
65  m_Q.matrix=NULL;
66  m_Q.num_rows=0;
67  m_Q.num_cols=0;
68 
69  return result;
70 }
static SGMatrix< float64_t > m_Q
int32_t index_t
Definition: common.h:62
virtual SGVector< float64_t > solve_optimization(SGVector< float64_t > mmds)
#define REQUIRE(x,...)
Definition: SGIO.h:206
index_t num_cols
Definition: SGMatrix.h:378
Kernel two sample test base class. Provides an interface for performing a two-sample test using a ker...
index_t num_rows
Definition: SGMatrix.h:376
virtual SGVector< float64_t > compute_measures()
The Combined kernel is used to combine a number of kernels into a single CombinedKernel object by lin...
virtual const char * get_name() const =0
CKernelTwoSampleTest * m_estimator
#define SG_UNREF(x)
Definition: SGObject.h:52
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual SGVector< float64_t > compute_statistic(bool multiple_kernels)=0
virtual EStatisticType get_statistic_type() const =0
Base class for kernel selection of combined kernels. Given an MMD instance whose underlying kernel is...

SHOGUN 机器学习工具包 - 项目文档