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 Soeren Sonnenburg 00008 * Copyright (C) 1999-2008 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 00019 class CHistogram : public CDistribution 00020 { 00021 public: 00023 CHistogram(); 00024 00029 CHistogram(CStringFeatures<uint16_t>* f); 00030 ~CHistogram(); 00031 00036 virtual bool train(); 00037 00042 virtual inline int32_t get_num_model_parameters() { return (1<<16); } 00043 00049 virtual float64_t get_log_model_parameter(int32_t num_param); 00050 00057 virtual float64_t get_log_derivative( 00058 int32_t num_param, int32_t num_example); 00059 00065 virtual float64_t get_log_likelihood_example(int32_t num_example); 00066 00072 virtual bool set_histogram(float64_t* src, int32_t num); 00073 00080 virtual void get_histogram(float64_t** dst, int32_t* num); 00081 00082 protected: 00084 float64_t* hist; 00085 }; 00086 #endif