SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DenseLabels.h
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 Heiko Strathmann
10  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
11  */
12 
13 #ifndef _DENSE_LABELS__H__
14 #define _DENSE_LABELS__H__
15 
16 #include <shogun/lib/config.h>
17 
18 #include <shogun/lib/common.h>
19 #include <shogun/io/File.h>
20 #include <shogun/labels/Labels.h>
22 
23 namespace shogun
24 {
25  class CFile;
26 
35 class CDenseLabels : public CLabels
36 {
37  public:
39  CDenseLabels();
40 
45  CDenseLabels(int32_t num_labels);
46 
51  CDenseLabels(CFile* loader);
52 
54  virtual ~CDenseLabels();
55 
62  virtual void ensure_valid(const char* context=NULL);
63 
70  virtual void load(CFile* loader);
71 
78  virtual void save(CFile* writer);
79 
88  bool set_label(int32_t idx, float64_t label);
89 
98  bool set_int_label(int32_t idx, int32_t label);
99 
107  float64_t get_label(int32_t idx);
108 
116  int32_t get_int_label(int32_t idx);
117 
123 
131 
139 
145  void set_to_one();
146 
152  void zero();
153 
161  void set_to_const(float64_t c);
162 
170 
177  void set_int_labels(SGVector<int32_t> labels);
178 
179 #if !defined(SWIGJAVA) && !defined(SWIGCSHARP)
180 
186  void set_int_labels(SGVector<int64_t> labels);
187 #endif
188 
193  virtual int32_t get_num_labels() const;
194 
199  virtual ELabelType get_label_type() const=0;
200 
201  public:
203  static const int32_t REJECTION_LABEL = -2;
204 
205  private:
206  void init();
207 
208  protected:
211 };
212 }
213 #endif

SHOGUN Machine Learning Toolbox - Documentation