SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MKLClassification.cpp
Go to the documentation of this file.
2 
4 
5 using namespace shogun;
6 
8 {
9  if (!s)
10  {
11 
12  if (!s)
13  s=new CLibSVM();
14  set_svm(s);
15  }
16 }
17 
19 {
20 }
22 {
23  float64_t suma=0;
24  int32_t nsv=svm->get_num_support_vectors();
25  for (int32_t i=0; i<nsv; i++)
26  suma+=CMath::abs(svm->get_alpha(i));
27 
28  return suma;
29 }
30 
32 {
33  REQUIRE(m_labels, "Labels not set.\n");
34  REQUIRE(m_labels->get_num_labels(), "Number of labels is zero.\n");
35  REQUIRE(m_labels->get_label_type() == LT_BINARY, "Labels must be binary.\n");
36 }
virtual ELabelType get_label_type() const =0
binary labels +1/-1
Definition: LabelTypes.h:14
LibSVM.
Definition: LibSVM.h:28
virtual int32_t get_num_labels() const =0
CLabels * m_labels
Definition: Machine.h:356
#define REQUIRE(x,...)
Definition: SGIO.h:208
CSVM * svm
Definition: MKL.h:451
double float64_t
Definition: common.h:48
float64_t get_alpha(int32_t idx)
Multiple Kernel Learning.
Definition: MKL.h:95
void set_svm(CSVM *s)
Definition: MKL.h:121
A generic Support Vector Machine Interface.
Definition: SVM.h:47
virtual float64_t compute_sum_alpha()
static T abs(T a)
return the absolute value of a number
Definition: Math.h:179

SHOGUN Machine Learning Toolbox - Documentation