DenseLabels.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 1999-2009 Soeren Sonnenburg
00008  * Written (W) 1999-2008 Gunnar Raetsch
00009  * Written (W) 2011 Heiko Strathmann
00010  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
00011  */
00012 
00013 #ifndef _DENSE_LABELS__H__
00014 #define _DENSE_LABELS__H__
00015 
00016 #include <shogun/lib/common.h>
00017 #include <shogun/io/File.h>
00018 #include <shogun/labels/Labels.h>
00019 #include <shogun/features/SubsetStack.h>
00020 
00021 namespace shogun
00022 {
00023     class CFile;
00024 
00033 class CDenseLabels : public CLabels
00034 {
00035     public:
00037         CDenseLabels();
00038 
00043         CDenseLabels(int32_t num_labels);
00044 
00049         CDenseLabels(CFile* loader);
00050 
00052         virtual ~CDenseLabels();
00053 
00060         virtual void ensure_valid(const char* context=NULL);
00061 
00068         virtual void load(CFile* loader);
00069 
00076         virtual void save(CFile* writer);
00077 
00086         bool set_label(int32_t idx, float64_t label);
00087 
00096         bool set_int_label(int32_t idx, int32_t label);
00097 
00105         float64_t get_label(int32_t idx);
00106 
00114         int32_t get_int_label(int32_t idx);
00115 
00122         SGVector<float64_t> get_labels();
00123 
00130         SGVector<float64_t> get_labels_copy();
00131 
00138         void set_labels(SGVector<float64_t> v);
00139 
00145         void set_to_one();
00146 
00152         void zero();
00153 
00161         void set_to_const(float64_t c);
00162 
00169         SGVector<int32_t> get_int_labels();
00170 
00177         void set_int_labels(SGVector<int32_t> labels);
00178 
00183         virtual int32_t get_num_labels();
00184 
00189         virtual ELabelType get_label_type()=0;
00190 
00191     public:
00193         static const int32_t REJECTION_LABEL = -2;
00194 
00195     private:
00196         void init();
00197 
00198     protected:
00200         SGVector<float64_t> m_labels;
00201 };
00202 }
00203 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation