32 void CMulticlassLabels::init()
41 "%s::set_multiclass_confidences(): Length of confidences should "
42 "match size of the matrix",
get_name());
60 REQUIRE(n_labels!=0,
"%s::allocate_confidences_for(): There should be "
61 "labels to store confidences",
get_name());
71 for (int32_t i=0; i<subset_size; i++)
74 int32_t label = int32_t(
m_labels[real_i]);
78 SG_ERROR(
"%s%sMulticlass Labels must be in range 0...<nr_classes-1> and integers!\n",
79 context?context:
"", context?
": ":
"");
93 bool use_confidences =
false;
96 use_confidences =
true;
100 for (int32_t k=0; k<binary_labels.
vlen; k++)
104 binary_labels[k] = label == i ? confidence : -confidence;
109 for (int32_t k=0; k<binary_labels.
vlen; k++)
112 binary_labels[k] = label == i ? +1.0 : -1.0;
140 CLabels* shallow_copy_labels=NULL;
143 SG_REF(shallow_copy_labels);
144 ((
CDenseLabels*) shallow_copy_labels)->set_labels(shallow_copy_vector);
148 return shallow_copy_labels;
void allocate_confidences_for(int32_t n_classes)
SGVector< index_t > get_subset_idx() const
SGVector< float64_t > m_labels
virtual CLabels * shallow_subset_copy()
virtual int32_t get_num_labels() const
CBinaryLabels * get_binary_for_class(int32_t i)
The class Labels models labels, i.e. class assignments of objects.
multi-class labels 0,1,...
virtual void ensure_valid(const char *context=NULL)
SGVector< float64_t > get_unique_labels()
SGMatrix< float64_t > m_multiclass_confidences
CSubsetStack * m_subset_stack
SGVector< float64_t > get_labels_copy()
int32_t get_num_classes()
CSubset * get_last_subset() const
SGVector< float64_t > get_multiclass_confidences(int32_t i)
int32_t get_int_label(int32_t idx)
A File access base class.
virtual const char * get_name() const
virtual void add_subset(SGVector< index_t > subset)
index_t subset_idx_conversion(index_t idx) const
void set_multiclass_confidences(int32_t i, SGVector< float64_t > confidences)
all of classes and functions are contained in the shogun namespace
virtual ELabelType get_label_type() const
virtual void ensure_valid(const char *context=NULL)
virtual bool has_subsets() const
Binary Labels for binary classification.
Dense integer or floating point labels.
static int32_t unique(T *output, int32_t size)
void set_labels(SGVector< float64_t > v)