SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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
virtual float64_t get_max_value() const
Definition: PlifArray.h:82
virtual const char * get_name() const
Definition: PlifArray.h:125
virtual float64_t get_min_value() const
Definition: PlifArray.h:91
virtual int32_t get_max_id() const
Definition: PlifArray.cpp:125
virtual float64_t lookup_penalty(float64_t p_value, float64_t *svm_values) const
Definition: PlifArray.cpp:62
virtual void penalty_add_derivative(float64_t p_value, float64_t *svm_values, float64_t factor)
Definition: PlifArray.cpp:110
int32_t get_num_plifs()
Definition: PlifArray.h:45
virtual void list_plif() const
Definition: PlifArray.h:114
#define SG_PRINT(...)
Definition: SGIO.h:137
void get_used_svms(int32_t *num_svms, int32_t *svm_ids)
Definition: PlifArray.cpp:133
float64_t max_value
Definition: PlifArray.h:131
Template Dynamic array class that creates an array that can be used like a list or an array...
Definition: DynArray.h:32
double float64_t
Definition: common.h:50
float64_t min_value
Definition: PlifArray.h:133
void add_plif(CPlifBase *new_plif)
Definition: PlifArray.cpp:36
class PlifBase
Definition: PlifBase.h:23
virtual ~CPlifArray()
Definition: PlifArray.cpp:32
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual bool uses_svm_values() const
Definition: PlifArray.cpp:117
virtual void penalty_clear_derivative()
Definition: PlifArray.cpp:104
class PlifArray
Definition: PlifArray.h:25
DynArray< CPlifBase * > m_array
Definition: PlifArray.h:129

SHOGUN Machine Learning Toolbox - Documentation