ECOCRandomDenseEncoder.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) 2012 Chiyuan Zhang
00008  * Copyright (C) 2012 Chiyuan Zhang
00009  */
00010 
00011 #ifndef ECOCRANDOMDENSEENCODER_H__
00012 #define ECOCRANDOMDENSEENCODER_H__
00013 
00014 #include <shogun/multiclass/ecoc/ECOCEncoder.h>
00015 
00016 namespace shogun
00017 {
00018 
00022 class CECOCRandomDenseEncoder: public CECOCEncoder
00023 {
00024 public:
00032     CECOCRandomDenseEncoder(int32_t maxiter=10000, int32_t codelen=0, float64_t pposone=0.5);
00033 
00035     virtual ~CECOCRandomDenseEncoder() {}
00036 
00040     void set_probability(float64_t pposone);
00041 
00043     virtual const char* get_name() const { return "ECOCRandomDenseEncoder"; }
00044 
00048     virtual SGMatrix<int32_t> create_codebook(int32_t num_classes);
00049 
00059     int32_t get_default_code_length(int32_t num_classes) const
00060     {
00061         return static_cast<int32_t>(CMath::round(10 * CMath::log(num_classes)));
00062     }
00063 
00064 protected:
00065     int32_t   m_maxiter; 
00066     int32_t   m_codelen; 
00067     float64_t m_pposone; 
00068 
00069 private:
00073     bool check_probability(float64_t pposone)
00074     {
00075         if (pposone >= 0.999 || pposone <= 0.0001)
00076             return false;
00077         return true;
00078     }
00079 
00081     void init();
00082 };
00083 
00084 } // namespace shogun
00085 
00086 #endif /* end of include guard: ECOCRANDOMDENSEENCODER_H__ */
00087 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation