SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Labels.cpp
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) 1999-2009 Soeren Sonnenburg
8  * Written (W) 1999-2008 Gunnar Raetsch
9  * Written (W) 2011-2012 Heiko Strathmann
10  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
11  */
12 
13 #include <shogun/labels/Labels.h>
14 #include <shogun/lib/common.h>
15 #include <shogun/io/SGIO.h>
16 #include <shogun/base/Parameter.h>
17 
18 using namespace shogun;
19 
21 : CSGObject()
22 {
23  init();
24 }
25 
27 {
29 }
30 
31 void CLabels::init()
32 {
33  SG_ADD((CSGObject**)&m_subset_stack, "subset_stack",
34  "Current subset stack", MS_NOT_AVAILABLE);
35 
38 }
39 
41 {
42  m_subset_stack->add_subset(subset);
43 }
44 
46 {
48 }
49 
51 {
53 }
54 
56 {
58  int32_t real_num=m_subset_stack->subset_idx_conversion(idx);
59  return m_confidences.vector[real_num];
60 }
61 
62 void CLabels::set_confidence(float64_t confidence, int32_t idx)
63 {
64  int32_t real_num=m_subset_stack->subset_idx_conversion(idx);
66  m_confidences.vector[real_num]=confidence;
67 }
68 
70 {
71  if (confidences.vlen!=0 && confidences.vlen!=get_num_labels())
72  {
73  SG_ERROR("length of confidence values should match number of labels or"
74  " have zero length (len(labels)=%d, len(confidences)=%d)\n",
75  get_num_labels(), confidences.vlen);
76  }
77 
78  m_confidences=confidences;
79 }
80 
82 {
83  return m_confidences;
84 }

SHOGUN Machine Learning Toolbox - Documentation