SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MPDSVM.h
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) 1999-2009 Soeren Sonnenburg
8  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _MPDSVM_H___
12 #define _MPDSVM_H___
13 #include <shogun/lib/common.h>
15 #include <shogun/lib/Cache.h>
16 
17 namespace shogun
18 {
20 class CMPDSVM : public CSVM
21 {
22  public:
24  CMPDSVM();
25 
32  CMPDSVM(float64_t C, CKernel* k, CLabels* lab);
33  virtual ~CMPDSVM();
34 
39  virtual inline EClassifierType get_classifier_type() { return CT_MPD; }
40 
42  inline virtual const char* get_name() const { return "MPDSVM"; }
43 
44  protected:
53  virtual bool train_machine(CFeatures* data=NULL);
54 
61  inline float64_t compute_H(int32_t i, int32_t j)
62  {
63  return labels->get_label(i)*labels->get_label(j)*kernel->kernel(i,j);
64  }
65 
71  inline KERNELCACHE_ELEM* lock_kernel_row(int32_t i)
72  {
73  KERNELCACHE_ELEM* line=NULL;
74 
75  if (kernel_cache->is_cached(i))
76  {
77  line=kernel_cache->lock_entry(i);
78  ASSERT(line);
79  }
80 
81  if (!line)
82  {
83  line=kernel_cache->set_entry(i);
84  ASSERT(line);
85 
86  for (int32_t j=0; j<labels->get_num_labels(); j++)
88  }
89 
90  return line;
91  }
92 
97  inline void unlock_kernel_row(int32_t i)
98  {
100  }
101 
104 };
105 }
106 #endif /* _MPDSVM_H___ */

SHOGUN Machine Learning Toolbox - Documentation