SHOGUN  5.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
MultilabelSOLabels.h
Go to the documentation of this file.
1 /*
2  * This software is distributed under BSD 3-clause license (see LICENSE file).
3  *
4  * Written (W) 2013 Thoralf Klein
5  * Written (W) 2014 Abinash Panda
6  * Copyright (C) 2013 Thoralf Klein and Zuse-Institute-Berlin (ZIB)
7  * Copyright (C) 2014 Abinash Panda
8  */
9 
10 #ifndef _MULTILABEL_SO_LABELS__H__
11 #define _MULTILABEL_SO_LABELS__H__
12 
13 #include <shogun/lib/config.h>
14 
16 #include <shogun/lib/SGVector.h>
20 
21 namespace shogun
22 {
23 
24 class CMultilabelSOLabels;
25 
29 {
30 public:
33 
36 
42 
45 
51  {
53  {
54  return (CSparseMultilabel *) base_data;
55  }
56  else
57  {
58  SG_SERROR("base_data must be of dynamic type CSparseMultilabel\n");
59  }
60 
61  return NULL;
62  }
63 
65  virtual const char * get_name() const
66  {
67  return "SparseMultilabel";
68  }
69 
72  {
73  return m_label;
74  }
75 
76 protected:
79 }; /* class CSparseMultilabel */
80 
87 {
88 public:
91 
96  CMultilabelSOLabels(int32_t num_classes);
97 
103  CMultilabelSOLabels(int32_t num_labels, int32_t num_classes);
104 
109  CMultilabelSOLabels(CMultilabelLabels * multilabel_labels);
110 
113 
115  virtual const char * get_name() const
116  {
117  return "MultilabelSOLabels";
118  }
119 
121  virtual int32_t get_num_labels() const;
122 
124  virtual int32_t get_num_classes() const;
125 
128 
133  virtual void set_sparse_labels(SGVector<int32_t> * labels);
134 
140  virtual void set_sparse_label(int32_t j, SGVector<int32_t> label);
141 
147  virtual bool set_label(int32_t j, CStructuredData * label);
148 
154  virtual void add_label(CStructuredData * label);
155 
160  virtual SGVector<int32_t> get_sparse_label(int32_t j);
161 
166  virtual CStructuredData * get_label(int32_t j);
167 
172  virtual void ensure_valid(const char * context = NULL);
173 
186  int32_t dense_dim, float64_t d_true, float64_t d_false);
187 
188 private:
189  CMultilabelLabels * m_multilabel_labels;
190  int32_t m_last_set_label;
191 
192 private:
193  void init();
194 
195 }; /* class CMultilabelSOLabels */
196 
197 } /* namespace shogun */
198 
199 #endif /* _MULTILABEL_SO_LABELS__H__ */
Base class of the labels used in Structured Output (SO) problems.
virtual const char * get_name() const
Class CMultilabelSOLabels used in the application of Structured Output (SO) learning to Multilabel Cl...
virtual void set_sparse_label(int32_t j, SGVector< int32_t > label)
virtual bool set_label(int32_t j, CStructuredData *label)
virtual EStructuredDataType get_structured_data_type() const
double float64_t
Definition: common.h:50
SGVector< int32_t > m_label
CSparseMultilabel(SGVector< int32_t > label)
Class CSparseMultilabel to be used in the application of Structured Output (SO) learning to Multilabe...
virtual void set_sparse_labels(SGVector< int32_t > *labels)
virtual void add_label(CStructuredData *label)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
#define SG_SERROR(...)
Definition: SGIO.h:179
static SGVector< float64_t > to_dense(CStructuredData *label, int32_t dense_dim, float64_t d_true, float64_t d_false)
virtual int32_t get_num_labels() const
virtual SGVector< int32_t > get_sparse_label(int32_t j)
virtual CStructuredData * get_label(int32_t j)
virtual int32_t get_num_classes() const
STRUCTURED_DATA_TYPE(SDT_SPARSE_MULTILABEL)
Multilabel Labels for multi-label classification.
Base class of the components of StructuredLabels.
static CSparseMultilabel * obtain_from_generic(CStructuredData *base_data)
SGVector< int32_t > get_data() const
virtual void ensure_valid(const char *context=NULL)
virtual CMultilabelLabels * get_multilabel_labels()
virtual const char * get_name() const

SHOGUN Machine Learning Toolbox - Documentation