SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MMDKernelSelectionCombMaxL2.cpp
Go to the documentation of this file.
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

SHOGUN Machine Learning Toolbox - Documentation