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 <shogun/features/StringFeatures.h> 00015 #include <shogun/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 00082 virtual bool set_histogram(SGVector<float64_t> histogram); 00083 00089 virtual SGVector<float64_t> get_histogram(); 00090 00092 inline virtual const char* get_name() const { return "Histogram"; } 00093 00094 protected: 00096 float64_t* hist; 00097 }; 00098 } 00099 #endif