SHOGUN  5.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
LabelsFactory.cpp
Go to the documentation of this file.
2 
10 
11 using namespace shogun;
12 
14 {
15  ASSERT(base_labels != NULL)
16  if (base_labels->get_label_type() == LT_BINARY)
17  return static_cast<CBinaryLabels*>(base_labels);
18  else
19  SG_SERROR("base_labels must be of dynamic type CBinaryLabels")
20 
21  return NULL;
22 }
23 
25 {
26  ASSERT(base_labels != NULL)
27  if (base_labels->get_label_type() == LT_LATENT)
28  return static_cast<CLatentLabels*>(base_labels);
29  else
30  SG_SERROR("base_labels must be of dynamic type CLatentLabels\n")
31 
32  return NULL;
33 }
34 
36 {
37  ASSERT(base_labels != NULL)
38  if (base_labels->get_label_type() == LT_MULTICLASS)
39  return static_cast<CMulticlassLabels*>(base_labels);
40  else
41  SG_SERROR("base_labels must be of dynamic type CMulticlassLabels\n")
42 
43  return NULL;
44 }
45 
47 {
48  ASSERT(base_labels != NULL)
49  if (base_labels->get_label_type() == LT_REGRESSION)
50  return static_cast<CRegressionLabels*>(base_labels);
51  else
52  SG_SERROR("base_labels must be of dynamic type CRegressionLabels")
53 
54  return NULL;
55 }
56 
58 {
59  ASSERT(base_labels != NULL)
60  if (base_labels->get_label_type() == LT_STRUCTURED)
61  return static_cast<CStructuredLabels*>(base_labels);
62  else
63  SG_SERROR("base_labels must be of dynamic type CStructuredLabels\n")
64 
65  return NULL;
66 }
67 
68 
70 {
71  ASSERT(base_labels != NULL)
72  if (base_labels->get_label_type() == LT_SPARSE_MULTILABEL)
73  return static_cast<CMultilabelLabels*>(base_labels);
74  else
75  SG_SERROR("base_labels must be of dynamic type CMultilabelLabels\n")
76 
77  return NULL;
78 }
79 
81 {
82  ASSERT(base_labels != NULL)
83  CMulticlassSOLabels* labels = dynamic_cast<CMulticlassSOLabels*>(base_labels);
84  if (labels == NULL)
85  SG_SERROR("base_labels must be of dynamic type CMulticlassSOLabels\n")
86 
87  return labels;
88 }
static CRegressionLabels * to_regression(CLabels *base_labels)
Base class of the labels used in Structured Output (SO) problems.
virtual ELabelType get_label_type() const =0
binary labels +1/-1
Definition: LabelTypes.h:18
Real Labels are real-valued labels.
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:43
real valued labels (e.g. for regression, classifier outputs)
Definition: LabelTypes.h:22
multi-class labels 0,1,...
Definition: LabelTypes.h:20
structured labels (e.g. sequences, trees) used in Structured Output problems
Definition: LabelTypes.h:24
static CMultilabelLabels * to_multilabel_output(CLabels *base_labels)
Multiclass Labels for multi-class classification.
latent latent labels
Definition: LabelTypes.h:26
static CBinaryLabels * to_binary(CLabels *base_labels)
#define ASSERT(x)
Definition: SGIO.h:201
static CMulticlassSOLabels * to_multiclass_structured(CLabels *base_labels)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
#define SG_SERROR(...)
Definition: SGIO.h:179
Binary Labels for binary classification.
Definition: BinaryLabels.h:37
sparse label class for multilabel classification (sets of labels)
Definition: LabelTypes.h:28
static CStructuredLabels * to_structured(CLabels *base_labels)
static CLatentLabels * to_latent(CLabels *base_labels)
Multilabel Labels for multi-label classification.
abstract class for latent labels As latent labels always depends on the given application, this class only defines the API that the user has to implement for latent labels.
Definition: LatentLabels.h:26
Class CMulticlassSOLabels to be used in the application of Structured Output (SO) learning to multicl...
static CMulticlassLabels * to_multiclass(CLabels *base_labels)

SHOGUN Machine Learning Toolbox - Documentation