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 00022 class CHistogram : public CDistribution 00023 { 00024 public: 00026 CHistogram(); 00027 00032 CHistogram(CStringFeatures<uint16_t>* f); 00033 virtual ~CHistogram(); 00034 00039 virtual bool train(); 00040 00045 virtual inline int32_t get_num_model_parameters() { return (1<<16); } 00046 00052 virtual float64_t get_log_model_parameter(int32_t num_param); 00053 00060 virtual float64_t get_log_derivative( 00061 int32_t num_param, int32_t num_example); 00062 00068 virtual float64_t get_log_likelihood_example(int32_t num_example); 00069 00075 virtual bool set_histogram(float64_t* src, int32_t num); 00076 00083 virtual void get_histogram(float64_t** dst, int32_t* num); 00084 00086 inline virtual const char* get_name() const { return "Histogram"; } 00087 00088 protected: 00090 float64_t* hist; 00091 }; 00092 #endif