SHOGUN  v3.1.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MulticlassSOLabels.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) 2013 Thoralf Klein
8  * Written (W) 2012 Fernando José Iglesias García
9  * Copyright (C) 2012 Fernando José Iglesias García
10  */
11 
12 #ifndef _MULTICLASS_SO_LABELS__H__
13 #define _MULTICLASS_SO_LABELS__H__
14 
16 #include <shogun/lib/SGVector.h>
19 
20 namespace shogun
21 {
22 
23 class CMulticlassSOLabels;
24 
31 {
34 
40 
46  {
47  if ( base_data->get_structured_data_type() == SDT_REAL )
48  return (CRealNumber*) base_data;
49  else
50  SG_SERROR("base_data must be of dynamic type CRealNumber\n")
51 
52  return NULL;
53  }
54 
56  virtual const char* get_name() const { return "RealNumber"; }
57 
60 };
61 
68 {
69  public:
72 
73  CMulticlassSOLabels(int32_t num_labels);
74 
80 
82  virtual ~CMulticlassSOLabels();
83 
88  inline int32_t get_num_classes() { return m_num_classes; }
89 
98  virtual void add_label(CStructuredData* label);
99 
106  virtual CStructuredData* get_label(int32_t idx);
107 
118  virtual bool set_label(int32_t idx, CStructuredData* label);
119 
124  virtual int32_t get_num_labels() const;
125 
127  virtual const char* get_name() const { return "MulticlassSOLabels"; }
128 
129  private:
130  void init();
131 
132  private:
134  int32_t m_num_classes;
135 
136  SGVector< float64_t > m_labels_vector;
137  int32_t m_num_labels_set;
138 
139 }; /* CMulticlassSOLabels */
140 
141 } /* namespace shogun */
142 
143 #endif /* _MULTICLASS_SO_LABELS__H__ */
Base class of the labels used in Structured Output (SO) problems.
virtual CStructuredData * get_label(int32_t idx)
static CRealNumber * obtain_from_generic(CStructuredData *base_data)
virtual const char * get_name() const
virtual EStructuredDataType get_structured_data_type() const
virtual int32_t get_num_labels() const
double float64_t
Definition: common.h:48
virtual const char * get_name() const
CRealNumber(float64_t val)
STRUCTURED_DATA_TYPE(SDT_REAL)
#define SG_SERROR(...)
Definition: SGIO.h:181
virtual void add_label(CStructuredData *label)
virtual bool set_label(int32_t idx, CStructuredData *label)
Class CRealNumber to be used in the application of Structured Output (SO) learning to multiclass clas...
Class CMulticlassSOLabels to be used in the application of Structured Output (SO) learning to multicl...
Base class of the components of StructuredLabels.

SHOGUN Machine Learning Toolbox - Documentation