Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members

plLearnKHistogram.h

00001 /*==============================================================================
00002  * Product        : OpenPL 
00003  * File           : plLearnKHistogram.h
00004  * Author         : Manuel Yguel
00005  * Creation       : Mon Nov 10 08:52:09 2003
00006  *
00007  *==============================================================================
00008  *     (c) Copyright 2000, Centre National de la Recherche Scientifique,
00009  *                              all rights reserved
00010  *==============================================================================
00011  *
00012  *------------------------- Description ----------------------------------------
00013  *   Learning n dimensionnal histograms with KNOWN variables definition sets.
00014  *   
00015  *------------------------------------------------------------------------------
00016 */
00017 
00018 
00019 #ifndef __plLearnKHistogram_h__
00020 #define __plLearnKHistogram_h__
00021 
00022 #include <plLearn.h>
00023 #include <plProbTable.h>
00024 
00025 class kplTableIndex;
00026 
00027 
00029 class plLearnKHistogram : public plNonCndLearnObject
00030 {
00031  public:
00033     plLearnKHistogram();
00034     
00036     plLearnKHistogram(const plVariablesConjunction &vars);
00037         
00039     template <class arrayType>
00040     plLearnKHistogram(const plVariablesConjunction &vars, arrayType init_freq, double init_weight=1.0)
00041         :plNonCndLearnObject(vars),
00042         _freq((unsigned int)vars.cardinality()),
00043         _init_freq(_freq.size()),
00044         _init_weight(init_weight),
00045         _has_initilization(true)
00046     {
00047         init_index();
00048         
00049         _total_weight = _init_weight;
00050         for(unsigned int i = 0; i < _freq.size(); i++) _init_freq[i] = _freq[i] = init_freq[i];
00051     }
00052     
00054     plLearnKHistogram(const plLearnKHistogram &histo);
00055     
00057     virtual ~plLearnKHistogram();
00058     
00060     void reset();
00061   
00064     void internal_addPoint(const plDataValues &point, double weight=1.0);
00065   
00067     void get_params(plValues &params) const;
00068   
00070     plKernel get_distribution( const void *parameters = NULL ) const;
00071     
00073     virtual void get_probability(vector <plProbValue> &table)const;
00074 
00077     virtual void get_probability(plProbValue *table)const;
00078     
00080     void get_frequency(vector <double> &table)const;
00081 
00084     void get_frequency(double *table)const;
00085     
00087     const vector <double> &get_frequency()const{return _freq;}
00088     
00090     void get_actual_min_max(plValues &min, plValues &max) const;
00091     
00093     unsigned int size()const{return _freq.size();}
00094 
00095     
00096 protected:
00097     void init_index();
00098   
00099   
00100 protected:
00101   
00102   vector <double> _freq;
00103   vector <double> _init_freq;
00104   double _init_weight;
00105   kplTableIndex *_var_index;
00106   
00107   bool _has_initilization;
00108   
00109 };
00110 
00111 #endif

Generated on Fri Apr 1 10:58:13 2005 for ProBT by  doxygen 1.4.1