SHOGUN  v3.2.0
MulticlassSOLabels.h
浏览该文件的文档.
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 CStructuredLabels;
24 class CMulticlassSOLabels;
25 
32 {
35 
41 
47  {
48  if ( base_data->get_structured_data_type() == SDT_REAL )
49  return (CRealNumber*) base_data;
50  else
51  SG_SERROR("base_data must be of dynamic type CRealNumber\n")
52 
53  return NULL;
54  }
55 
57  virtual const char* get_name() const { return "RealNumber"; }
58 
61 };
62 
69 {
70  public:
73 
78  CMulticlassSOLabels(int32_t num_labels);
79 
85 
87  virtual ~CMulticlassSOLabels();
88 
93  inline int32_t get_num_classes() { return m_num_classes; }
94 
103  virtual void add_label(CStructuredData* label);
104 
111  virtual CStructuredData* get_label(int32_t idx);
112 
123  virtual bool set_label(int32_t idx, CStructuredData* label);
124 
129  virtual int32_t get_num_labels() const;
130 
132  virtual const char* get_name() const { return "MulticlassSOLabels"; }
133 
134  private:
135  void init();
136 
137  private:
139  int32_t m_num_classes;
140 
141  SGVector< float64_t > m_labels_vector;
142  int32_t m_num_labels_set;
143 
144 }; /* CMulticlassSOLabels */
145 
146 } /* namespace shogun */
147 
148 #endif /* _MULTICLASS_SO_LABELS__H__ */
Base class of the labels used in Structured Output (SO) problems
virtual EStructuredDataType get_structured_data_type() const
virtual const char * get_name() const
static CRealNumber * obtain_from_generic(CStructuredData *base_data)
double float64_t
Definition: common.h:48
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:16
STRUCTURED_DATA_TYPE(SDT_REAL)
#define SG_SERROR(...)
Definition: SGIO.h:181
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