PlifArray.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) 1999-2008 Gunnar Raetsch
00008  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef __PLIFARRAY_H__
00012 #define __PLIFARRAY_H__
00013 
00014 #include "lib/common.h"
00015 #include "lib/Mathematics.h"
00016 #include "lib/DynamicArray.h"
00017 #include "structure/PlifBase.h"
00018 
00020 class CPlifArray: public CPlifBase
00021 {
00022     public:
00024         CPlifArray();
00025         virtual ~CPlifArray();
00026 
00031         void add_plif(CPlifBase* new_plif);
00032 
00034         void clear();
00035 
00040         int32_t get_num_plifs()
00041         {
00042             return m_array.get_num_elements();
00043         }
00044 
00050         virtual float64_t lookup_penalty(
00051             float64_t p_value, float64_t* svm_values) const;
00052 
00058         virtual float64_t lookup_penalty(
00059             int32_t p_value, float64_t* svm_values) const;
00060 
00062         virtual void penalty_clear_derivative();
00063 
00069         virtual void penalty_add_derivative(
00070             float64_t p_value, float64_t* svm_values);
00071 
00076         virtual float64_t get_max_value() const
00077         {
00078             return max_value;
00079         }
00080 
00085         virtual float64_t get_min_value() const
00086         {
00087             return min_value;
00088         }
00089 
00094         virtual bool uses_svm_values() const;
00095 
00100         virtual int32_t get_max_id() const;
00101 
00102         void get_used_svms(int32_t* num_svms, int32_t* svm_ids);
00103 
00108         virtual void list_plif() const 
00109         {
00110             SG_PRINT("CPlifArray(num_elements=%i, min_value=%1.2f, max_value=%1.2f)\n", m_array.get_num_elements(), min_value, max_value) ;
00111             for (int32_t i=0; i<m_array.get_num_elements(); i++)
00112             {
00113                 SG_PRINT("%i. ", i) ;
00114                 m_array[i]->list_plif() ;
00115             }
00116         }
00117 
00119         inline virtual const char* get_name() const { return "PlifArray"; }
00120 
00121     protected:
00123         CDynamicArray<CPlifBase*> m_array;
00125         float64_t max_value;
00127         float64_t min_value;
00128 };
00129 
00130 #endif

SHOGUN Machine Learning Toolbox - Documentation