SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlifArray.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-2008 Gunnar Raetsch
8  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef __PLIFARRAY_H__
12 #define __PLIFARRAY_H__
13 
14 #include <shogun/lib/common.h>
16 #include <shogun/base/DynArray.h>
18 
19 namespace shogun
20 {
21 
23 class CPlifArray: public CPlifBase
24 {
25  public:
27  CPlifArray();
28  virtual ~CPlifArray();
29 
34  void add_plif(CPlifBase* new_plif);
35 
37  void clear();
38 
43  int32_t get_num_plifs()
44  {
45  return m_array.get_num_elements();
46  }
47 
53  virtual float64_t lookup_penalty(
54  float64_t p_value, float64_t* svm_values) const;
55 
61  virtual float64_t lookup_penalty(
62  int32_t p_value, float64_t* svm_values) const;
63 
65  virtual void penalty_clear_derivative();
66 
73  virtual void penalty_add_derivative(
74  float64_t p_value, float64_t* svm_values, float64_t factor);
75 
80  virtual float64_t get_max_value() const
81  {
82  return max_value;
83  }
84 
89  virtual float64_t get_min_value() const
90  {
91  return min_value;
92  }
93 
98  virtual bool uses_svm_values() const;
99 
104  virtual int32_t get_max_id() const;
105 
106  void get_used_svms(int32_t* num_svms, int32_t* svm_ids);
107 
112  virtual void list_plif() const
113  {
114  SG_PRINT("CPlifArray(num_elements=%i, min_value=%1.2f, max_value=%1.2f)\n", m_array.get_num_elements(), min_value, max_value)
115  for (int32_t i=0; i<m_array.get_num_elements(); i++)
116  {
117  SG_PRINT("%i. ", i)
118  m_array[i]->list_plif() ;
119  }
120  }
121 
123  virtual const char* get_name() const { return "PlifArray"; }
124 
125  protected:
132 };
133 }
134 #endif

SHOGUN Machine Learning Toolbox - Documentation