SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MKLClassification.cpp
Go to the documentation of this file.
2 #ifdef USE_SVMLIGHT
4 #endif //USE_SVMLIGHT
6 
7 using namespace shogun;
8 
10 {
11  if (!s)
12  {
13 #ifdef USE_SVMLIGHT
14  s=new CSVMLight();
15 #endif //USE_SVMLIGHT
16  if (!s)
17  s=new CLibSVM();
18  set_svm(s);
19  }
20 }
21 
23 {
24 }
26 {
27  float64_t suma=0;
28  int32_t nsv=svm->get_num_support_vectors();
29  for (int32_t i=0; i<nsv; i++)
30  suma+=CMath::abs(svm->get_alpha(i));
31 
32  return suma;
33 }
34 
36 {
37  REQUIRE(m_labels, "Labels not set.\n");
38  REQUIRE(m_labels->get_num_labels(), "Number of labels is zero.\n");
39  REQUIRE(m_labels->get_label_type() == LT_BINARY, "Labels must be binary.\n");
40 }
virtual ELabelType get_label_type() const =0
binary labels +1/-1
Definition: LabelTypes.h:18
LibSVM.
Definition: LibSVM.h:30
virtual int32_t get_num_labels() const =0
CLabels * m_labels
Definition: Machine.h:361
#define REQUIRE(x,...)
Definition: SGIO.h:206
CSVM * svm
Definition: MKL.h:451
double float64_t
Definition: common.h:50
float64_t get_alpha(int32_t idx)
Multiple Kernel Learning.
Definition: MKL.h:95
void set_svm(CSVM *s)
Definition: MKL.h:121
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
class SVMlight
Definition: SVMLight.h:225
A generic Support Vector Machine Interface.
Definition: SVM.h:49
virtual float64_t compute_sum_alpha()
static T abs(T a)
Definition: Math.h:179

SHOGUN Machine Learning Toolbox - Documentation