SHOGUN  5.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
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 
15 #include <shogun/lib/config.h>
16 
18 #include <shogun/lib/SGVector.h>
21 
22 namespace shogun
23 {
24 
25 class CStructuredLabels;
26 class CMulticlassSOLabels;
27 
34 {
37 
43 
49  {
50  if ( base_data->get_structured_data_type() == SDT_REAL )
51  return (CRealNumber*) base_data;
52  else
53  SG_SERROR("base_data must be of dynamic type CRealNumber\n")
54 
55  return NULL;
56  }
57 
59  virtual const char* get_name() const { return "RealNumber"; }
60 
63 };
64 
71 {
72  public:
75 
80  CMulticlassSOLabels(int32_t num_labels);
81 
87 
89  virtual ~CMulticlassSOLabels();
90 
95  inline int32_t get_num_classes() { return m_num_classes; }
96 
105  virtual void add_label(CStructuredData* label);
106 
113  virtual CStructuredData* get_label(int32_t idx);
114 
125  virtual bool set_label(int32_t idx, CStructuredData* label);
126 
131  virtual int32_t get_num_labels() const;
132 
134  virtual const char* get_name() const { return "MulticlassSOLabels"; }
135 
136  private:
137  void init();
138 
139  private:
141  int32_t m_num_classes;
142 
143  SGVector< float64_t > m_labels_vector;
144  int32_t m_num_labels_set;
145 
146 }; /* CMulticlassSOLabels */
147 
148 } /* namespace shogun */
149 
150 #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:50
virtual const char * get_name() const
CRealNumber(float64_t val)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
STRUCTURED_DATA_TYPE(SDT_REAL)
#define SG_SERROR(...)
Definition: SGIO.h:179
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