SHOGUN  3.2.1
 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/config.h>
15 
16 #include <shogun/lib/common.h>
18 #include <shogun/base/DynArray.h>
20 
21 namespace shogun
22 {
23 
25 class CPlifArray: public CPlifBase
26 {
27  public:
29  CPlifArray();
30  virtual ~CPlifArray();
31 
36  void add_plif(CPlifBase* new_plif);
37 
39  void clear();
40 
45  int32_t get_num_plifs()
46  {
47  return m_array.get_num_elements();
48  }
49 
55  virtual float64_t lookup_penalty(
56  float64_t p_value, float64_t* svm_values) const;
57 
63  virtual float64_t lookup_penalty(
64  int32_t p_value, float64_t* svm_values) const;
65 
67  virtual void penalty_clear_derivative();
68 
75  virtual void penalty_add_derivative(
76  float64_t p_value, float64_t* svm_values, float64_t factor);
77 
82  virtual float64_t get_max_value() const
83  {
84  return max_value;
85  }
86 
91  virtual float64_t get_min_value() const
92  {
93  return min_value;
94  }
95 
100  virtual bool uses_svm_values() const;
101 
106  virtual int32_t get_max_id() const;
107 
108  void get_used_svms(int32_t* num_svms, int32_t* svm_ids);
109 
114  virtual void list_plif() const
115  {
116  SG_PRINT("CPlifArray(num_elements=%i, min_value=%1.2f, max_value=%1.2f)\n", m_array.get_num_elements(), min_value, max_value)
117  for (int32_t i=0; i<m_array.get_num_elements(); i++)
118  {
119  SG_PRINT("%i. ", i)
120  m_array[i]->list_plif() ;
121  }
122  }
123 
125  virtual const char* get_name() const { return "PlifArray"; }
126 
127  protected:
134 };
135 }
136 #endif

SHOGUN Machine Learning Toolbox - Documentation