SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ECOCRandomDenseEncoder.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) 2012 Chiyuan Zhang
8  * Copyright (C) 2012 Chiyuan Zhang
9  */
10 
11 #ifndef ECOCRANDOMDENSEENCODER_H__
12 #define ECOCRANDOMDENSEENCODER_H__
13 
15 
16 namespace shogun
17 {
18 
23 {
24 public:
32  CECOCRandomDenseEncoder(int32_t maxiter=10000, int32_t codelen=0, float64_t pposone=0.5);
33 
36 
40  void set_probability(float64_t pposone);
41 
43  virtual const char* get_name() const { return "ECOCRandomDenseEncoder"; }
44 
48  virtual SGMatrix<int32_t> create_codebook(int32_t num_classes);
49 
59  int32_t get_default_code_length(int32_t num_classes) const
60  {
61  return static_cast<int32_t>(CMath::round(10 * CMath::log(num_classes)));
62  }
63 
64 protected:
65  int32_t m_maxiter;
66  int32_t m_codelen;
68 
69 private:
73  bool check_probability(float64_t pposone)
74  {
75  if (pposone >= 0.999 || pposone <= 0.0001)
76  return false;
77  return true;
78  }
79 
81  void init();
82 };
83 
84 } // namespace shogun
85 
86 #endif /* end of include guard: ECOCRANDOMDENSEENCODER_H__ */
87 

SHOGUN Machine Learning Toolbox - Documentation