SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
DenseLabels.h
浏览该文件的文档.
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
SGVector< float64_t > m_labels
Definition: DenseLabels.h:210
void set_int_labels(SGVector< int32_t > labels)
virtual int32_t get_num_labels() const
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:43
virtual ELabelType get_label_type() const =0
float64_t get_label(int32_t idx)
SGVector< float64_t > get_labels_copy()
Definition: DenseLabels.cpp:90
bool set_label(int32_t idx, float64_t label)
SGVector< float64_t > get_labels()
Definition: DenseLabels.cpp:82
int32_t get_int_label(int32_t idx)
double float64_t
Definition: common.h:50
static const int32_t REJECTION_LABEL
Definition: DenseLabels.h:203
A File access base class.
Definition: File.h:34
void set_to_const(float64_t c)
Definition: DenseLabels.cpp:63
SGVector< int32_t > get_int_labels()
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual void ensure_valid(const char *context=NULL)
bool set_int_label(int32_t idx, int32_t label)
Dense integer or floating point labels.
Definition: DenseLabels.h:35
void set_labels(SGVector< float64_t > v)
Definition: DenseLabels.cpp:74
virtual void load(CFile *loader)
ELabelType
Definition: LabelTypes.h:15
virtual void save(CFile *writer)

SHOGUN 机器学习工具包 - 项目文档