SHOGUN  v2.0.0
 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/common.h>
17 #include <shogun/io/File.h>
18 #include <shogun/labels/Labels.h>
20 
21 namespace shogun
22 {
23  class CFile;
24 
33 class CDenseLabels : public CLabels
34 {
35  public:
37  CDenseLabels();
38 
43  CDenseLabels(int32_t num_labels);
44 
49  CDenseLabels(CFile* loader);
50 
52  virtual ~CDenseLabels();
53 
60  virtual void ensure_valid(const char* context=NULL);
61 
68  virtual void load(CFile* loader);
69 
76  virtual void save(CFile* writer);
77 
86  bool set_label(int32_t idx, float64_t label);
87 
96  bool set_int_label(int32_t idx, int32_t label);
97 
105  float64_t get_label(int32_t idx);
106 
114  int32_t get_int_label(int32_t idx);
115 
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 
183  virtual int32_t get_num_labels();
184 
189  virtual ELabelType get_label_type()=0;
190 
191  public:
193  static const int32_t REJECTION_LABEL = -2;
194 
195  private:
196  void init();
197 
198  protected:
201 };
202 }
203 #endif

SHOGUN Machine Learning Toolbox - Documentation