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 00018 class CHistogram : public CDistribution 00019 { 00020 public: 00022 CHistogram(); 00023 00028 CHistogram(CStringFeatures<WORD>* f); 00029 ~CHistogram(); 00030 00035 virtual bool train(); 00036 00041 virtual inline INT get_num_model_parameters() { return (1<<16); } 00042 00048 virtual DREAL get_log_model_parameter(INT num_param); 00049 00056 virtual DREAL get_log_derivative(INT num_param, INT num_example); 00057 00063 virtual DREAL get_log_likelihood_example(INT num_example); 00064 00070 virtual bool set_histogram(DREAL* src, INT num); 00071 00078 virtual void get_histogram(DREAL** dst, INT* num); 00079 00080 protected: 00082 DREAL* hist; 00083 }; 00084 #endif