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-2009 Soeren Sonnenburg 00008 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #ifndef _HISTOGRAM_H___ 00012 #define _HISTOGRAM_H___ 00013 00014 #include "features/StringFeatures.h" 00015 #include "distributions/Distribution.h" 00016 00017 namespace shogun 00018 { 00019 template <class ST> class CStringFeatures; 00020 00026 class CHistogram : public CDistribution 00027 { 00028 public: 00030 CHistogram(); 00031 00036 CHistogram(CStringFeatures<uint16_t>* f); 00037 virtual ~CHistogram(); 00038 00047 virtual bool train(CFeatures* data=NULL); 00048 00053 virtual inline int32_t get_num_model_parameters() { return (1<<16); } 00054 00060 virtual float64_t get_log_model_parameter(int32_t num_param); 00061 00068 virtual float64_t get_log_derivative( 00069 int32_t num_param, int32_t num_example); 00070 00076 virtual float64_t get_log_likelihood_example(int32_t num_example); 00077 00083 virtual bool set_histogram(float64_t* src, int32_t num); 00084 00091 virtual void get_histogram(float64_t** dst, int32_t* num); 00092 00094 inline virtual const char* get_name() const { return "Histogram"; } 00095 00096 protected: 00098 float64_t* hist; 00099 }; 00100 } 00101 #endif